Skip to content

Commit

Permalink
Clicked the Log in With Google Option
Browse files Browse the repository at this point in the history
- I was overcomplicating it.
- Now I am getting the frame, then from within the frame, access the text
- TODO: Log in in the new window now!
  • Loading branch information
Antonio Cucciniello authored and Antonio Cucciniello committed May 12, 2021
1 parent 4647724 commit f491170
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ function sleep(ms) {
await sleep(1000)
await page.click('.login-wrapper button')
await sleep(10000)
const loginIframe = await page.$('iframe')
const loginPage = await loginIframe.contentFrame()
await loginPage.click('.')
// get the iframes on the page, there should be two
const mainiFrames = await page.frames()
// select the second iframe which is the login windor
const loginFrame = mainiFrames[1]
// click the div so you can log in with Google!
await loginFrame.click('text=Log in with Google')
await sleep(2000)
// create pages, interact with UI elements, assert values
await browser.close()
Expand Down

3 comments on commit f491170

@chinedufn
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Next you'll want to use .fill to fill out the input fields

https://playwright.dev/docs/input/#text-input

For an iframe it is probably loginFrame.fill ...

@acucciniello
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

loginFrame.fill did not work - its not the right page, its still the previous log in pop, not the new one. Working on a solution right now.

@chinedufn
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.