Reputation: 675
I have a tool which load a website, fill in the information, and save the result. It was working fine until last week. After debugging, I found out the reason is because the site URL "became" redirected.
The redirected sequence is like below. (for example, site url is google.com
)
google.com` → google.com\somethingbetween → google.com (yes, the final redirected url is exactly the same as the original url)
If I open chrome and navigate to the url manually, the page is loaded fine. But if opened by selenium chromedriver, it will stop as google.com\somethingbetween
. The strange thing is if I manually enter the url inside the address bar of the browser which was opened by ChromeDirver (will have a little popup saying that the browser is currently controlled by automation tool), the browser will also stop at the second page ( google.com\somethingbetween
).
I tried to use the Chrome beta version 79 (with chrome driver v79) but the problem didn't go away.
Upvotes: 4
Views: 8849
Reputation: 101
The redirection issue occurs when "driver.get()" method is used. Please try using "driver.navigate().to()" method to navigate to the url. This may solve the issue.
Linking a related question: How do I switch to redirected url using selenium web driver
Upvotes: 3
Reputation: 57
Use Chrome driver of stable version which may help you to get rid of this problem.Because under this version there is an issue of "issue 3133: window.navigator.webdriver is undefined when "enable-automation" is excluded in non-headless mode (should be true) [Pri-2].So do try with the stable versions like v78,v77.
Upvotes: 3