0

I have been trying to create account within Instagram Sign up page with selenium and python, and I am able to enter all info into the text boxes, but for some reason, I am unable to click the "Sign up" button. I have tried using find element by XPath,CSS,ID, and class name but python still says that it cannot find the element. This is after entering all other necessary info on the form. Does anyone have any ideas?

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
cordmana
  • 121
  • 3
  • 12

2 Answers2

0

The desired elements is a React element so to click on the element you have to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

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

options = webdriver.ChromeOptions() 
options.add_argument("start-maximized")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
driver = webdriver.Chrome(options=options, executable_path=r'C:\WebDrivers\chromedriver.exe')
driver.get("https://www.instagram.com/accounts/emailsignup/")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//input[@name='emailOrPhone']"))).send_keys("9876543210")
driver.find_element_by_xpath("//input[@name='fullName']").send_keys("aforkman")
driver.find_element_by_xpath("//input[@name='username']").send_keys("aforkman")
driver.find_element_by_xpath("//input[@name='password']").send_keys("aforkman")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//button[text()='Sign up']"))).click()

Browser Snapshot:

instagram_signin

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

You can use this way :

driver.find_element_by_xpath("//button[contain(text() , "Sign up")]").click()

reza79
  • 11
  • 1