Reputation: 483
I would like to know if it is possible to switch to redirected url using java selenium web driver.
I am doing automation for an app in facebook, but the developer of that app has used "Request dialog" facebook api feature which accepts "redirect_url" in java script.
How do I switch my web driver to that redirected page?
One solution for this is
String redirected_url = driver.getCurrentUrl();//This url is not matching with the one showing in address bar.
driver.get(redirected_url);
Problem with the above is same page is loading again but now with redirected url showing in address bar and it is allowing me to do automation further
I need a solution something like which will use driver.switchTo().
Actually when I click on a button it is redirecting to another page (redirecting url is internal, we cant see this url in address bar but can fetch using driver.getCurrentUrl()). This redirecting url we can get using selenium web driver but there is no change in page source after redirect
Thanks in advance for your help.
Upvotes: 4
Views: 32804
Reputation: 27516
I am not familiar with Facebook API but I guess driver.navigate().to(url);
is what you are looking for.
Upvotes: 7