我正试图编写一个脚本来从this website中提取数据
我试着运行下面的一段代码
from selenium import webdriver
import time
driver = webdriver.Chrome(executable_path='C:/Users/blackwidow/Desktop/USHL data scraping/chromedriver.exe')
url = ("https://www.ushl.com/view#/schedule")
driver.get(url)
driver.find_element_by_xpath("//select[@ng-model ='selectedSeason']/option[@label='2019-20']").click()
time.sleep(3)
driver.find_element_by_xpath("//select[@ng-model ='selectedTeam']/option[@label='Youngstown Phantoms']").click()
time.sleep(3)
到目前为止,它工作得很好
然后,我需要单击名为“提交”的按钮,该按钮的定义如下:
<a href="" class="ht-btn-submit ng-binding" ng-click="getSeasonSchedule();">SUBMIT</a>
我尝试了以下代码行
driver.find_element_by_xpath("//span[@ng-click=\'getSeasonSchedule();']").click()
这是行不通的
我试过以下方法,但没有效果
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH,
"//div[@class='ht-col-left']//a[contains(@href, '')]/span[@ng-
click=\'getSeasonSchedule();']"))).click()
将其用于“提交”按钮
相关问题 更多 >
编程相关推荐