from selenium import webdriver
import time
import regg
from selenium.webdriver.common.action_chains import ActionChains
browser = webdriver.Chrome("E:\\Nice\\chromedriver.exe") #Starting Firefox Browser
url="https://www.instagram.com/"
browser.get(url)
time.sleep
phone=browser.find_element_by_xpath('//*[@id="react-root"]/section/main/article/div[2]/div[1]/div/form/div[3]/div/label/input')
phone.send_keys('0947464451')
fullname=browser.find_element_by_name("fullName")
fullname.send_keys(regg.user1)
username=browser.find_element_by_name("username")
username.send_keys (regg.user1)
password =browser.find_element_by_name("password")
password.send_keys(regg.password)
singup=browser.find_element_by_xpath("//*[@id='react-root']/section/main/article/div[2]/div[1]/div/form/div[7]/div/button").click()
Asked
Active
Viewed 997 times
0
AMC
- 2,642
- 7
- 13
- 35
Youngsamurai
- 3
- 1
-
Hi, what exactly error occurred? – Iwona Feb 23 '20 at 09:47
1 Answers
0
AFAIK, you're trying to reach the phone number input field on instagram main page. However, the locator is working, I've checked just now. The probable reason is in page loading. There is a pre-loader on instagram website which loads page ~1-2sec.
In this case try to use ImplicitWait instead of sleep. Just put it right after driver.get(url) :
driver.manage().timeouts().implicitlyWait(7, TimeUnit.SECONDS);
My code snippet is in Java. Interpret it to Python is not a hard thing.
Hope this will help.
Villa_7
- 508
- 4
- 14