0
from selenium import webdriver
from info import user_name, pass_word
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import time

driver = webdriver.Firefox() #opening web browser

driver.get('https://tuportal.temple.edu/') #going to temple wbsite

username = driver.find_element_by_id("username") #finds space where to enteruser
password = driver.find_element_by_id("password") #same for password
username.send_keys(user_name()) #enters my username
password.send_keys(pass_word()) #enters my password

driver.find_element_by_name("_eventId_proceed").click()#click login

#waits until the element for student tools tab is found
element = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.ID, "layout_8")))
element.click()

time.sleep(3)
driver.switch_to_frame("iFrame_AppTupChannelsStudentRegistration")#accessing iframe

#scrolls
element = driver.find_element_by_id('StudentRegistration_3')
driver.execute_script("return arguments[0].scrollIntoView();", element)
#end of scroll

element.click() #click look up classes

All of the code works up until the last line, "element.click()" I am getting an error -->

Traceback (most recent call last): File "C:\Users\Karl\Desktop\project\signin.py", line 31, in element.click() #click look up classes File "C:\Users\Karl\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click self._execute(Command.CLICK_ELEMENT) File "C:\Users\Karl\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webelement.py", line 628, in _execute return self._parent.execute(command, params) File "C:\Users\Karl\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute self.error_handler.check_response(response) File "C:\Users\Karl\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementNotInteractableException: Message: Element could not be scrolled into view

The confusing part is the 2 lines right before the line that causes the error are

element = driver.find_element_by_id('StudentRegistration_3')
driver.execute_script("return arguments[0].scrollIntoView();", element)

which do exactly what the error says hasn't happened, they scroll the the button I am trying to click on with the last line into view. Can anyone identify a solution? I am using python 3, selenium and Firefox are updated to current versions.

0 Answers0