[英]Getting error in using expected_conditions in python + selenium
我一直在使用python和selenium進行自動化,這是我經常遇到的錯誤。
WebDriverException: Message: u'An invalid or illegal string was specified'
我不確定是怎么了。 此錯誤在我的代碼的以下行中發生:
wait = WebDriverWait(self.driver, 10)
wait.until(expected_conditions.element_to_be_clickable(By.CSS_SELECTOR,"a:contains(Sign In)"))
請幫忙!
問題是a:contains(Sign in)
是無效的CSS。
如果您想使用CSS, a[href*='Sign In']
也許可以解決問題,但是看起來您正在單擊鏈接,因此最好的解決方案是使用By.LINK_TEXT,"Sign In"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.