'Selenium webdriver.get() method doesnt always work

link = "https://www.google.com"
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % str(xxx))
chrome = webdriver.Chrome(chrome_options=chrome_options)
time.sleep(3)
chrome.get(link)
print("po get")
time.sleep(1)
chrome.get(link)
time.sleep(15)

Hello, I have a problem with selenium for a long time and I would like to find a way how to fix it The problem is that almost everytime I run a script that's opening selenium / even when I use it like for a test such as :

from selenium import webdriver
chrome = webdriver.Chrome()
chrome.get(https://www.google.com)

It still sometimes doesn't get the website, I thought it's because of how slow selenium opens but even after its nicely open it doesn't get the value, sadly it just gets stuck on an empty browser that had data in an url window... any idea what should I do to fix it?



Solution 1:[1]

You can use driver.navigate.to("");

Also as I see, You might missing String Double Quotes " " here, chrome.get(https://www.google.com)

Solution 2:[2]

I think it's too late for answer, but I want to answer anyway. You may have already solved problem, but if it doesn't work check this out:

  1. Different links navigate you same site or etc. It is not a code error but I want to say that this could cause of selenium.common.exceptions.NoSuchElementException: Message: no such element
  2. You logged a site and if you want to go back login screen, you should log out of your account, otherwise the site will automatically navigate to the home screen because you already logged in.

That's all I wanted to say.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ishita Shah
Solution 2 lane