0
from selenium import webdriver
browser = webdriver.Chrome()
browser.get('https://instagram.com')
browser.maximize_window()

browser.find_element_by_xpath("//body/div[@id='react-root']/section[1]/main[1]/article[1]/div[2]/div[1]/div[1]/form[1]/div[1]/div[1]/div[1]/label[1]/input[1]")
browser.find_element_by_xpath("//body/div[@id='react-root']/section[1]/main[1]/article[1]/div[2]/div[1]/div[1]/form[1]/div[1]/div[2]/div[1]/label[1]/input[1]")

İ tryed all things but i cant solve it what is the problem, im always getting error:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="loginForm"]/div/div[1]/div/label/input"}

1 Answers1

0

you should use wait

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(browser, 10)

wait.until(EC.visibility_of_element_located((By.XPATH, '.your xpath')))
javadfarah
  • 46
  • 5