Skip to content Skip to sidebar Skip to footer

In Selenium, How To Handle Invalidselectorexception While Log In Website

I'm trying to log in website with selenium. This is the code that I made. from selenium import webdriver driver = webdriver.Chrome() driver.get('https://abcde.com') assert 'xxx'

Solution 1:

You are using CSS selector incorrectly. It needs to have an element tied to it, but you are trying to find using an attribute value.

In order for it to work you need to change your CSS selector to this.

Solution 1.

driver.find_element_by_css_selector("input[id='ctl00_MasterHeaderPlaceHolder_ctl00_tempPasswordTextbox']")

Solution 2

As the elements have name attribute, you can use "find_element_by_name".

driver.find_element_by_name("ctl00$MasterHeaderPlaceHolder$ctl00$tempPasswordTextbox")

Post a Comment for "In Selenium, How To Handle Invalidselectorexception While Log In Website"