Selenium will open chrome tab but not find URL - python

Selenium starts a blank chrome tab but does not go to the specified link. I would Imagine its a fairly simple fix. My selenium is up to date.
My Code
Error Output

try the below command
browser.get('https://www.google.com')

Related

Selenium Python can't open a second page while using chrome webbrowser

I am using Selenium to open different pages of a site. Have tried multiple times but the browser does not open a second webpage after the initial GET call. Have tried on Chrome. Below is the screenshot of the error:
enter image description here
Looking forward to your support on it.

Python : Browser not able to browse URL using selenium

I am writing a python script which includes opening up an URL and do some activity on it. I am facing an issue when i execute below code then Firefox browser starts but it is not able to browse URL. What could be wrong here..?
I also tried to add proxy exception but that isn't solve issue.
from selenium import webdriver
browser = webdriver.Firefox()
browser.get('WEBSITE_URL')
So, Pls suggest what is wrong here.

Chromedriver.exe has stopped working - python

I keep getting this error:
https://sites.google.com/a/chromium.org/chromedriver/help/chromedriver-crashes
I get it when running the command:
python Web.py
However when I go into the file and run the lines 1 by 1, I don't get the error. However I always get the error when the Web.py file has finished. When I run the lines 1 by 1, it's very basic things but i feel like I"m not ending my script correctly.
import selenium
from selenium.webdriver.common.keys import Keys
import time
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('espn.com')
I want the window with espn.com to stay on the screen, not quit when the script has finished.
I'm running this on Python. I can share my setup, maybe that's something I did incorreclty but any help would be appeciated.
You're passing an invalid url.
You need to pass the url like this:
driver.get("http://www.espn.com")
This might work in your browser, but it won't with selenium. Type in "espn.com" in your browser and then copy / paste the url and you'll see that it's actually the above url.
You should also specify the "chromedriver.exe" path.
You are getting this error because you had not installed the chrome driver for selenium on your Machine. Selenium by default provides the driver for Firefox so when you use the webdriver for Firefox, it won't rise any error. To resolve this issue with Chrome you can download the Chrome webdriver from here.
and you can specify the driver as
from selenium import webdriver
d = webdriver.Chrome(executable_path='<your Chrome driver path>')
Adding to what #Pythonista said , it's better if you keep the URL as a raw string than a normal string
driver.get(r'http://www.espn.com')
so that it won't take the slash as an escape sequence in few cases.
Hope it helps.
Try to update chrome and get updated/latest chrome driver, recently chrome made several updates in its driver you can download the last one from the link below:
https://chromedriver.storage.googleapis.com/2.27/chromedriver_win32.zip

How can I move WebDriver to new opened Chrome tab without knowing index?

I am using the Selenium Python Bindings for web browser automation in Chrome. As part of the automation script, I click on a link and the website opens the page in a new tab. However, the WebDriver object in my python script is still pointing to the first tab.
I have tried all of the options offered on this answer but none were successful.
The only code I have been able to get to work so far is this:
driver.switch_to.window(driver.window_handles[1])
The problem I have with this is that I'm afraid I can't guarantee that the new tab will be at index 1, nor do I think I can guarantee that the new tab is at the last index. I did try using keys like this:
driver.find_element_by_tag_name('body').send_keys(Keys.CONTROL + Keys.TAB)
But using some logging I saw that the driver was still pointing to the first tab. Is there a way to focus on the current tab that chrome is showing?
Whenever I have cases like these I switch to the last window handle, so far it worked for me:
driver.switch_to.window(driver.window_handles[-1])

why 2nd click action is not run when browser is Google Chrome

I don't konw why 2nd click action is not be run when browser is Google Chrome.
The 1st input action: input text has been done, then 2nd click action failed to be run
And there's nothing happened on the UI.
Could anybody can tell me the reason?
test link:https://www-01.ibm.com/products/hardware/configurator/americas/bhui/launchNI.wss
from selenium import webdriver driver=webdriver.Chrome()
driver.get('https://www-01.ibm.com/products/hardware/configurator/americas/bhui/launchNI.wss') driver.find_element_by_id("modelnumber").send_keys("7383AC1")
driver.find_element_by_name("submit").click()
That page has 3 elements with the name "submit", so ChromeDriver is probably trying to click one that you're not expecting.
Try finding by xpath or css. I'm more familiar with XPath:
driver.find_element_by_xpath("//input[#id='modelnumber']/../following-sibling::td/input[#name='submit']").click()

Categories