简体   繁体   中英

Getting error in using expected_conditions in python + selenium

I have been using python and selenium for automation and here is the error I am getting frequently.

WebDriverException: Message: u'An invalid or illegal string was specified' 

I am not sure what is wrong. This error occurs in the following line of my code:

wait = WebDriverWait(self.driver, 10)
wait.until(expected_conditions.element_to_be_clickable(By.CSS_SELECTOR,"a:contains(Sign In)"))

Please help!

The problem is that a:contains(Sign in) is not valid CSS.

If you want to do CSS, a[href*='Sign In'] might do the trick, but it looks like you're clicking on a link, so the best solution is to do By.LINK_TEXT,"Sign In"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM