Click here to Skip to main content
15,885,978 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,
its my code
Python
driver = uc.Chrome(use_subprocess=True)
wait = WebDriverWait(driver, 20)
url = 'https://accounts.google.com/ServiceLogin?service=accountsettings&continue=https://myaccount.google.com%3Futm_source%3Daccount-marketing-page%26utm_medium%3Dgo-to-account-button'
driver.get(url)


wait.until(EC.visibility_of_element_located((By.NAME, 'identifier'))).send_keys(email)
wait = WebDriverWait(driver, 20)
wait.until(EC.visibility_of_element_located((By.NAME, 'password'))).send_keys(password)


WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, "//header/div[2]/div[3]/div[1]/div[1]/div[1]/div[1]/a[1]")))

driver.execute_script('''window.open("www.google.com","_blank");''') 
driver.switch_to.window(driver.window_handles[1])



google logs in but then gives this error
Error
driver.switch_to.window(driver.window_handles[1])
IndexError: list index out of range


I guess after waiting it goes to the next line without running javascript

I need help, Thanks

What I have tried:

i tried this
wait.until(EC.visibility_of_element_located((By.XPATH, ''))).execute_script('window.open(''"www.google.com","_blank");''')


and this but not worked
wait = WebDriverWait(driver, 20)
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900