简体   繁体   English

引发 TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException:消息:断言失败

[英]raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: Assertion failed

I have a problem with Selenium Webdriver, trying to locate the element, the program gives an error "raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: Assertion failed"我有 Selenium Webdriver 的问题,试图定位元素,程序给出错误“raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: Assertion failed”

My code is with a page-object model: My code: 1st part -我的代码是一个页面对象模型:我的代码:第一部分 -

  def located_element(self, locator):
        wait = WebDriverWait(self.driver, 30)
        element = wait.until(EC.presence_of_element_located(locator))
        return element

2nd part第二部分

 def enter_email(self, user):
        email_field = self.located_element(self.locator.Email)
        email_field.click()
        email_field.send_keys(Users.get_user(user)["email"])

3rd(running)第三(运行)

I have tried some recommendations from related issues but it didn't help me.我尝试了相关问题的一些建议,但没有帮助我。 At first, it couldn't find the element, that's why I added EC, but now it raises an error.起初,它找不到元素,这就是我添加 EC 的原因,但现在它引发了错误。 Please, help me, how can I handle the Exception.请帮助我,我该如何处理异常。 I have tried the locator both with xpath and css-selector too.我也尝试过使用 xpath 和 css-selector 的定位器。

In the first time you open the site the email field doesn't have class input-error .在您第一次打开网站时,电子邮件字段没有类input-error Try尝试

email_field = self.located_element((By.CSS_SELECTOR, '[data-login-source="loginPage"] [name="email"]'))

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: 消息: - TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: 引发TimeoutException(消息,屏幕,堆栈跟踪)selenium.common.exceptions.TimeoutException:消息:使用Selenium Python - raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: using Selenium Python 引发 TimeoutException(消息,屏幕,堆栈跟踪)selenium.common.exceptions.TimeoutException:消息 - raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: for send whatsapp to all conatcts - raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: for sending whatsapp to all conatcts 引发TimeoutException(消息,屏幕,堆栈跟踪)selenium.common.exceptions.TimeoutException:消息: - raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: 元素不可见。 引发TimeoutException(消息,屏幕,堆栈跟踪)selenium.common.exceptions.TimeoutException - Element is not visible. raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException Python selenium:超时异常(消息,屏幕,堆栈跟踪)selenium.common.exceptions.TimeoutException:消息: - Python selenium : TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message: 消息:selenium.common.exceptions.TimeoutException - Message: selenium.common.exceptions.TimeoutException selenium.common.exceptions.TimeoutException:消息: - selenium.common.exceptions.TimeoutException: Message: 错误:selenium.common.exceptions.TimeoutException:消息: - error: selenium.common.exceptions.TimeoutException: Message:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM