Reputation: 29149
I have this site in which there is you can authenticate using Facebook. Unfortunately my site is not public at the moment, but to give you an idea you can see it in action at agar.io -> click Login and play
and click Sign in with Facebook
. Now you get a popup window.
With Webdriver I can easily control the page, but I don't know how to access this popup window (using javascript) ?
My code is like this:
var browser = new webdriver.Builder().usingServer().withCapabilities({
'browserName': 'chrome'
}).build();
From there on I can navigate my site. But how do I get from the browser
object to this popup window such that I can fill in the credentials?
Upvotes: 0
Views: 195
Reputation: 5113
There's no need to do anything special to handle the popup. This pseudocode should describe the solution (all selectors work):
click by XPath: //button[text()='Login and play']
click by XPath: //button[span/text()='Sign in with Facebook']
wait until CSS path exists: #facebook body
<any additional form-filling>
click by XPath: //button[text()='Play Now']
Upvotes: 1