Djaenk / zyBooks-Activity-Completer

Python 3 script which automatically completes assigments on the zyBooks platform.
MIT License
16 stars 14 forks source link

Firefox Headless Client closes just after initiation #19

Closed DaoudS closed 3 years ago

DaoudS commented 3 years ago

Error produced from the log reads:

Traceback (most recent call last): File "C:\Users\daoud\Downloads\zyBooks-Activity-Completer\complete.py", line 416, in login(driver) File "C:\Users\daoud\Downloads\zyBooks-Activity-Completer\complete.py", line 59, in login if not email: UnboundLocalError: local variable 'email' referenced before assignment

Even after defining the email and password variables in the global variables and in a local scope to the function Simillar errors are produced.

Enter your zybooks login below with the course code email = "" # "ExampleEmail@gmail.com" course = "" # "ExampleCourseCode"

def login(driver): driver.get("https://learn.zybooks.com/signin") while (True): email_input = driver.find_element_by_xpath("//input[@type='email']") password_input = driver.find_element_by_xpath("//input[@type='password']") signin_button = driver.find_element_by_class_name("signin-button")

    if not email:
        email = input("Please enter your zyBooks email: ")
    email_input.send_keys(myEmail)
    if (email == "quit"):
        print("--Exiting--")
        driver.quit()
        os._exit(0)

    password = getpass.getpass("Enter your zyBooks password: ")
    if (password == "quit"):
        print("--Exiting--")
        driver.quit()
        os._exit(0)

exception.log geckodriver.log

Djaenk commented 3 years ago

Fixed, sorry for the wait