Open recook792 opened 4 years ago
when i log attempt to log in by running the "togetherness.logIn()" , i get the following error "NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="react-root"]/section/main/div/article/div/div[1]/div/form/div[2]/div/label/input"} (Session info: chrome=86.0.4240.111)"
do you know why this might be or how i get get around it? note: i'm sure this is an error on my end since i'm a super beginner with coding and not with the code itself.
thanks for any insight/help with this!
yes i too got an same error ...what's the solution for the error plzz post the solution
when i log attempt to log in by running the "togetherness.logIn()" , i get the following error "NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="react-root"]/section/main/div/article/div/div[1]/div/form/div[2]/div/label/input"} (Session info: chrome=86.0.4240.111)" do you know why this might be or how i get get around it? note: i'm sure this is an error on my end since i'm a super beginner with coding and not with the code itself. thanks for any insight/help with this!
yes i too got an same error ...what's the solution for the error plzz post the solution
Not much of a solution, rather a workaround
` def instagramLogin(self,driver):
"""
Logs in to Instagram
Args:
Current webdriver
Returns:
Current webdriver - logged into Instagram
"""
#base url
driver.get('https://www.instagram.com/accounts/login/?source=auth_switcher')
sleep(2) #wait
#log in
#username_field = driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/article/div/div[1]/div/form/div[2]/div/label/input')
username_field = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[name='username']")))
#username_field.click() #click on username button
#send username
username_field.send_keys(self._username)
#locate element to click
#try:
# password_field = driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/article/div/div[1]/div/form/div[3]/div/label/input')
#except:
# password_field = driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/article/div/div[1]/div/form/div[4]/div/label/input')
password_field = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input[name='password']")))
#password_field.click()
password_field.send_keys(self._password)
sleep(2)
#find log in button
#login_button = driver.find_element_by_xpath('//*[@id="react-root"]/section/main/div/article/div/div[1]/div/form/div[4]')
login_button = WebDriverWait(driver, 2).until(EC.element_to_be_clickable((By.CSS_SELECTOR, "button[type='submit']"))).click()
#login_button.click()
sleep(3)
#locate floating window to click and close
#floating_window = driver.find_element_by_class_name('piCib')
#button = floating_window.find_element_by_class_name('mt3GC')
#not_now = button.find_element_by_xpath('/html/body/div[4]/div/div/div[3]/button[2]')
#not_now.click()
alert = WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.XPATH, '//button[contains(text(), "Not Now")]'))).click()
alert2 = WebDriverWait(driver, 15).until(EC.element_to_be_clickable((By.XPATH, '//button[contains(text(), "Not Now")]'))).click()
return driver
`
Remind!!!: When it comes to the place like 'Not Now' PLZ!! BE Careful about it suppercase or lowercase problem!!
when i log attempt to log in by running the "togetherness.logIn()" , i get the following error "NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="react-root"]/section/main/div/article/div/div[1]/div/form/div[2]/div/label/input"} (Session info: chrome=86.0.4240.111)"
do you know why this might be or how i get get around it? note: i'm sure this is an error on my end since i'm a super beginner with coding and not with the code itself.
thanks for any insight/help with this!