Home > Net >  Retrieve class schedule changes from website using python and selenium No Such Element error, ID, XP
Retrieve class schedule changes from website using python and selenium No Such Element error, ID, XP

Time:10-22

My school has a system that tells us if our schedule has any changes.

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait, Select
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.select import Select


url = "https://www.alliancetlv.com/עדכוני-מערכת"
driver = webdriver.Chrome()
driver.get(url)
driver.implicitly_wait(5.0)

examButton = driver.find_element(By.ID, 'TimeTableView1_btnChanges')

im trying to find an element, and later click it using selenium. every time i try to find literally anything it returns No Such Element error. I tried by ID, class name, name, and more.

this is the website: https://www.alliancetlv.com/עדכוני-מערכת and im trying to click one of the tabs called "changes/שינויים"

my end goal is to click the dropdown to the side, select a class, click the changes tab, then get all the data inside of it, then maybe format it.

CodePudding user response:

You can not seek the element because it is layed inside the iframe. So, you have to:

  1. find iframe
  2. switch to it
  3. find your element
  4. click on it
frame = driver.find_element(By.XPATH, value="//iframe[@title='Embedded Content']")
driver.switch_to.frame(frame)
elem = driver.find_element(By.XPATH, value="//a[contains(@id,'TimeTableView1_btnChanges')]")
elem.click()

See docs...

  • Related