繁体   English   中英

无法获取 selenium python 在谷歌地图上点击提交按钮

[英]Can't get selenium python to click the submit button on google maps

无法获取 selenium python 以单击谷歌地图上的提交按钮。 我已经能够让它在谷歌地图搜索栏中输入文本,但就是这样。

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import time

PATH = "C:\Program Files (x86)\chromedriver.exe"
driver = webdriver.Chrome(PATH)

driver.get("https://www.google.com/maps/")

inputboxes = driver.find_elements(By.CLASS_NAME, 'text_field')
driver.find_element(By.ID, 'searchboxinput').send_keys("byu store")

element = WebDriverWait(driver, 10).until(
    driver.find_element((By.ID, "searchbox-searchbutton"))
)
element.click()

这部分不起作用。

element = WebDriverWait(driver, 10).until(
    driver.find_element((By.ID, "searchbox-searchbutton"))
)
element.click()

使用以下命令单击搜索按钮。

element = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, "searchbox-searchbutton")))
element.click()

进口

from selenium.webdriver.support.ui import WebDriverWait 
from selenium.webdriver.support import expected_conditions as EC

您之前的代码有一个

selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: 'using' must be a string

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM