0

I am trying to write a script to scrape data from this website.

I tried running a block of code below.

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)

It worked perfectly up to this point.

Then, I needed to click the button named 'Submit,' which is defined as follows:

<a href="" class="ht-btn-submit ng-binding" ng-click="getSeasonSchedule();">SUBMIT</a>

I tried the following line of code

driver.find_element_by_xpath("//span[@ng-click=\'getSeasonSchedule();']").click()

which did not work.

I have tried the following, to no avail.

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()

1 Answer 1

1

Use this for the Submit button.

driver.find_element_by_xpath('//a[@class="ht-btn-submit ng-binding"]').click()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.