-1

I'm running selenium tests with complex data. When the test with 1st data completed successfully, before launch test with 2nd data i get this Error:

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x04638850>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"Unable to locate element: [id=\\"username\\"]...ror@chrome://marionette/content/error.js:389:5\\nelement.find/</<@chrome://marionette/content/element.js:339:16\\n"}}'}
  • More detailed code would help and the exact point of error. Seems like you are trying to find element that doesn't exist on the page – ranjith Mar 11 '19 at 05:39
  • You are probably trying to locate the element before it's been loaded. look into `support.expected_conditions` so the page waits for the element before interacting with it. – Shilo Mar 11 '19 at 05:41

1 Answers1

0

when you launch test with 2nd, the HTML don't have a element of '[id=\"username\"]' you should wait 2nd HTML load the element of '[id=\"username\"]'

there is solution wait the 2nd HTML element

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, '[id=\\"username\\"]')))
hyrama
  • 21
  • 3