Quantcast
Viewing all articles
Browse latest Browse all 14040

Selenium WebDriver Dynamic acess button Error

I´m trying to do a full download of the pdfs from my University Page but i´m stuck in a part where a dynamic JavaScript part appears.

I can login, acess the courses page and then after click the correct course a "page" appears where I need to click at least two "buttons" to acess the files.

I keep getting error trying to do the same approach I have done to login and acess the course page. How can i solve it?

import timefrom selenium import webdriverfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as EC# Define the username and password optionscredentials = {"username": "username","password": "password"}# Initialize Chrome WebDriverdriver = webdriver.Chrome()driver.implicitly_wait(0.5)# Open the URLdriver.get("https://elearning.uminho.pt/")# Find the link by its href attributelink = driver.find_element(By.XPATH, "//a[contains(@href, '/auth-saml/saml/login')]")link.click()# Find the username input field and enter the usernameusername_input = driver.find_element(By.ID, "userNameInput")username_input.send_keys(credentials["username"])# Find the password input field and enter the passwordpassword_input = driver.find_element(By.ID, "passwordInput")password_input.send_keys(credentials["password"])# Find the "Iniciar sessão" button and click itlogin_button = driver.find_element(By.ID, "submitButton")login_button.click()# Navigate to the Course pagedriver.get("https://elearning.uminho.pt/ultra/courses/_59511_1/cl/outline")# Wait for the page to loadtime.sleep(2)CLICK1<div id="puller" class="pullcollapsed"><a aria-expanded="false" aria-controls="menuWrap-inner" id="menuPuller" class="clickpuller" title="Mostrar menu Curso" href="#" role="button"><img id="expander" alt="Mostrar menu Curso" src="https://learn.content.blackboardcdn.com/3900.84.0-rel.38+5527ec7/images/spacer.gif"></a></div>CLICK2<a href="/webapps/blackboard/content/listContent.jsp?course_id=_59511_1&amp;content_id=_1403205_1&amp;mode=reset" target="_self"><span title="Conteúdo">Conteúdo</span></a># Wait for a few seconds for demonstration purposestime.sleep(5)# Quit the driverdriver.quit()

Image may be NSFW.
Clik here to view.
enter image description here
Image may be NSFW.
Clik here to view.
enter image description here

Trying to acess the MenuPuller and the Conteudo part.


Viewing all articles
Browse latest Browse all 14040

Trending Articles