[英]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. 我一直在使用python和selenium进行自动化,这是我经常遇到的错误。
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. 问题是
a:contains(Sign in)
是无效的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"
如果您想使用CSS,
a[href*='Sign In']
也许可以解决问题,但是看起来您正在单击链接,因此最好的解决方案是使用By.LINK_TEXT,"Sign In"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.