Когда браузер открывается, он просто остается на месте и не действует.
Код: Выделить всё
The driver.get(url)Код: Выделить всё
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service as ChromeService
import time
chrome_executable_path = r"C:\Program Files\Google\Chrome\Application\chrome.exe"
# path to the chrome profile to get the logged google acc
chrome_profile_dir = r"C:\Users\myuser\AppData\Local\Google\Chrome\User Data\Profile 3"
# use the chrome profile
chrome_options = Options()
chrome_options.add_argument(f"user-data-dir={chrome_profile_dir}")
service = ChromeService(executable_path=chrome_executable_path)
driver = webdriver.Chrome(service=service, options=chrome_options)
# this doesn't work, but it's not related to the url/nothing after this
url = "https://docs.google.com/forms/d/e/myformid/viewform?usp=pp_url&entry.1824=abc&entry.20988=def&entry.1589=123"
driver.get(url)
time.sleep(10)
submit_button = driver.findElement(By.xpath("//span[text()='Enviar']"))
submit_button.click()
# wait for form submission
time.sleep(10)
driver.quit()
What I'm attempting is to submit a prefilled google form. I don't know how to get my current session to make the post request to /formresponse so I figured I would directly use the instance that is already loged in.
Источник: https://stackoverflow.com/questions/781 ... chrome-url