...
Code Block |
---|
(sung) sungbae@~/Downloads$ pytest ./test_computeHazardCurve.py
...
====================================================================== FAILURES =============================================================================
____________________________________________________ TestComputeHazardCurve.test_computeHazardCurve _________________________________________________________
self = <test_computeHazardCurve.TestComputeHazardCurve object at 0x7fdb4b91ca58>
def test_computeHazardCurve(self):
self.driver.get("https://development.seistech.nz/")
self.driver.set_window_size(1680, 1027)
self.driver.find_element(By.ID, "qs-login-btn").click()
self.driver.find_element(By.ID, "username").click()
self.driver.find_element(By.ID, "username").send_keys("sungeunbae@live.com")
self.driver.find_element(By.ID, "password").send_keys("XXXX")
self.driver.find_element(By.NAME, "action").click()
> self.driver.find_element(By.LINK_TEXT, "Hazard Analysis").click()
raise exception_class(message, screen, stacktrace, alert_text)
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"link text","selector":"Hazard Analysis"}
E (Session info: chrome=85.0.4183.83)
../sung/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py:242: NoSuchElementException
=================================================================== 1 failed in 10.69s ====================================================================== |
Add the following line before line 29, and force it to wait for the element to load first.
Code Block |
---|
WebDriverWait(self.driver, 30000).until(expected_conditions.presence_of_element_located((By.XPATH, "//a[contains(text(),\'Hazard Analysis\')]"))) |
Related articles
Content by Label |
---|
showLabels | false |
---|
max | 5 |
---|
spaces | QuakeCore |
---|
showSpace | false |
---|
sort | modified |
---|
reverse | true |
---|
type | page |
---|
cql | label = "kb-how-to-article" and type = "page" and space = "QuakeCore" |
---|
labels | kb-how-to-article |
---|
|
...