简体   繁体   English

在python +硒中使用Expected_conditions时出现错误

[英]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.

相关问题 Python中使用Selenium的Expected_conditions - expected_conditions with Selenium in Python Selenium的预期条件[Python] - expected_conditions with Selenium [Python] selenium.common.exceptions.TimeoutException 错误使用 WebDriverWait 通过 Selenium 和 Python - selenium.common.exceptions.TimeoutException error using WebDriverWait with expected_conditions through Selenium and Python 通过硒和python 3使用element_to_be_clickable方法时,Expected_Conditions返回TimeoutException - Expected_Conditions returns TimeoutException while using element_to_be_clickable method through selenium & python 3 在 heroku 中使用 expected_conditions 时出现 TimeoutException - getting TimeoutException when using expected_conditions in heroku selenium.common.exceptions.TimeoutException 在使用 Selenium Python 中的 expected_conditionspresence_of_element_located 单击按钮时 - selenium.common.exceptions.TimeoutException while clicking on a button using expected_conditions presence_of_element_located in Selenium Python __init __()接受2个位置参数,但是使用Selenium Python使用WebDriverWait和Expected_conditions作为element_to_be_clickable给出了3个 - __init__() takes 2 positional arguments but 3 were given using WebDriverWait and expected_conditions as element_to_be_clickable with Selenium Python 将 while 语句与 WebDriverWait 和 expected_conditions 一起使用 - Using while statement with WebDriverWait and expected_conditions 为什么 Selenium python package 中没有 expected_conditions all_of、none_of 和 any_of? - Why are expected_conditions all_of, none_of, and any_of absent in the Selenium python package? “TypeError: ‘str’ object is not callable” 在 expected_conditions 内通过 Python + Selenium 传递定位器 - "TypeError: 'str' object is not callable" passing locator within expected_conditions through Python + Selenium
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM