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:
- find iframe
- switch to it
- find your element
- 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()