NoSuchElementError: no such element: Unable to locate element:
The function you're invoking are asynchronous
You click and put your driver to sleep, but the rest of the code is still executed.
Try using the await keyword if you're in an async function, or .then() to execute the rest of the code
my_function = async () => {
var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome()).build();
until = webdriver.until;
await driver.get('http://www.automationpractice.com');
await driver.manage().window().maximize();
await driver.findElement(webdriver.By.linkText("Sign in")).click();
await driver.sleep(10000);
await driver.findElement(webdriver.By.id("email_create")).sendKeys("natanatantsaq1w@pl.pl")
}
Check all the function you're calling to see if it returns a Promise
Unable to locate element and no such element error using Selenium and Python
Using WebDriverWait
wait for element to be clickable before click on it:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# ...
wait = WebDriverWait(driver, 10)
wait.until(EC.element_to_be_clickable((By.LINK_TEXT, 'Customer Details'))).click()
# css selector
# wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, 'a[href="https://mylink"]'))).click()
Related Topics
Keep Overflow Div Scrolled to Bottom Unless User Scrolls Up
Reactjs and Images in Public Folder
Convert Milliseconds to Hours and Minutes Using Momentjs
React-Native: Convert Image Url to Base64 String
How to Array Filter With Multiple Condition in JavaScript
Angular - Displaying Object Within Object in Json
Accessing Ejs Variable in JavaScript Logic
Securityerror: Blocked a Frame With Origin from Accessing a Cross-Origin Frame
Validating Array of Different Object Shapes in Yup
How to Disable Onclick Without Altering Its Function
How to Redirect Drop Down Menu When Option Is Selected
Nosuchelementerror: Unable to Locate Element - Selenium Webdriver Using JavaScript
How to Manage Hide and Show Multiple Div and Sections Using Jquery
How to Get a Div Element from an External Webpage in HTML File
How to Compare Dates in Mongo Query
How to Separate String and Push to React State
How to Add a New Object (Key-Value Pair) to an Array in JavaScript