Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 98788

Selenium Cant Find Element On New Window

$
0
0

Selenium finds all the elements I need it to find until I click a button that redirects to a new window. This Is The Code

options = Options()
    options.binary_location = "C:\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
    driver = webdriver.Chrome(chrome_options = options, executable_path=r'C:\Users\future\Desktop\Coding\Python\Bored\chromedriver.exe')
    driver.get("https://accounts.google.com/signup/v2/webcreateaccount?continue=https%3A%2F%2Faccounts.google.com%2FManageAccount&gmb=exp&biz=false&flowName=GlifWebSignIn&flowEntry=SignUp")
    fname = driver.find_element_by_id("firstName")
    fname.send_keys(name)
    fname.send_keys(Keys.TAB)
    lsname = driver.find_element_by_id("lastName")
    lsname.send_keys(lname) 
    lsname.send_keys(Keys.TAB)
    user = driver.find_element_by_id("username")
    user.send_keys(username_true)
    user.send_keys(Keys.TAB)
    user.send_keys(Keys.TAB)
    passcode = driver.find_element_by_xpath("//*[@id=\"passwd\"]/div[1]/div/div[1]/input")
    passcode.send_keys(password_true)
    passcode.send_keys(Keys.TAB)
    confirmpass = driver.find_element_by_xpath("//*[@id=\"confirm-passwd\"]/div[1]/div/div[1]/input")
    confirmpass.send_keys(confirmpas)
    confirmpass.send_keys(Keys.TAB)
    confirmpass.send_keys(Keys.TAB)
    confirmpass.send_keys(Keys.ENTER)
    print('Email:{}  Password:{}'.format(username_true, password_true))
    phnum = driver.find_element_by_id("phoneNumberId")# This Is The One It Cant Find The Other ones are on the first Window
    phnum.send_keys(phonenum_true)

    time.sleep(100000000000000000000000000000000000000000000000000000000000000000000000000000000000000)

This Is The Error

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="phoneNumberId"]"}
  (Session info: chrome=79.0.3945.88)

Viewing all articles
Browse latest Browse all 98788

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>