我在硒测试中遇到问题,我尝试使用其他等待方法,但无济于事。
html
<span class="MuiTypography-root MuiListItemText-primary MuiTypography-body1">Sign Out</span>
log_out.py
imports
@when('I click on sign out button')
def step_impl(context):
wait = WebDriverWait(context.browser, 20)
#navbar_right_content = context.browser.find_element_by_css_selector("div[class^='navbar-user-profile-menu']")
navbar_right_content = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR,"div[class^='menu']")))
navbar_right_content.click()
sign_out = wait.until(EC.visibility_of_element_located((By.XPATH,'//span*[contains(text(), "Sign Out")]')))
sign_out.click()
错误
> Traceback (most recent call last):
> File "/usr/local/lib/python3.7/site-packages/selenium/webdriver/support/wait.py",
> line 80, in until
> raise TimeoutException(message, screen, stacktrace)
> selenium.common.exceptions.TimeoutException: Message: