0
Greetings, I am beginner in Selenium and follows below my script:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import time
links=['']
for link in links:
browser=webdriver.Chrome(r'C:\Users\Administrador\Downloads\chromedriver.exe')
browser.execute_script("window.open('https://www.onlinevideoconverter.com/pt/youtube-converter');")
time.sleep(1)
ak=browser.find_element_by_id('texturl')
ak.send_keys(link)
au = WebDriverWait(browser, 30).until( EC.element_to_be_clickable((By.XPATH, '//*[text() = "Começar"]')) )
au.click()
af = WebDriverWait(browser, 90).until(
EC.presence_of_element_located((By.ID, 'downloadq'))
)
browser.execute_script('arguments[0].click();', af)
That basically takes the download link and does it automatically.
The problem that happens is that when I use browser.execute_script("window.open('https://www.onlinevideoconverter.com/pt/youtube-converter');")
the method ak=browser.find_element_by_id('texturl')
is not loaded. Even using time.sleep
.
I wanted to know if it is possible to solve without using the browser.get('https://www.onlinevideoconverter.com/pt/youtube-converter')
What’s wrong?