reteps/kbot

Selenium TimeoutException:While Playing

danielkp1234 opened this issue · 15 comments

So Here is the stacktrace
Traceback (most recent call last):
File "C:\Users\danil\OneDrive\Desktop\danielkahootbot-master\kahootlib.py", line 77, in bot_answer
waitForItem(driver, "div#app",timeout=20)
File "C:\Users\danil\OneDrive\Desktop\danielkahootbot-master\kahootlib.py", line 13, in waitForItem
WebDriverWait(driver, timeout).until(expected_conditions.visibility_of_element_located((By.CSS_SELECTOR, css)))
File "C:\Users\danil\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "kbot", line 23, in
kahootlib.start_bot(sys.argv[2],NAME,colors)
File "C:\Users\danil\OneDrive\Desktop\danielkahootbot-master\kahootlib.py", line 67, in start_bot
bot_answer(driver,colors)
File "C:\Users\danil\OneDrive\Desktop\danielkahootbot-master\kahootlib.py", line 80, in bot_answer
except selenium.common.exceptions.TimeoutException:
NameError: name 'selenium' is not defined

for what I can understand I timeouts and then does not restart so when playing kahoot when I have like answered like 2 questions i just get that stacktrace and it does not run anymore isnt it just needing to catch the exception???

Will look into it this later. Selenium May have renamed the exception I am trying to catch

@reteps now it just keeps skipping the question like while the teachers are waiting in between questions it just keeps skipping

Fixed

@reteps Still geting the timeout exception¨
the code is now that u changed it
except ElementNotVisibleException:

but now i have problem with
Traceback (most recent call last):
File "kbot", line 23, in
kahootlib.start_bot(sys.argv[2],NAME,colors)
File "C:\Users\danil\OneDrive\Desktop\danielkahootbot-master\kahootlib.py", line 66, in start_bot
bot_answer(driver,colors)
File "C:\Users\danil\OneDrive\Desktop\danielkahootbot-master\kahootlib.py", line 76, in bot_answer
waitForItem(driver, "div#app",timeout=20)
File "C:\Users\danil\OneDrive\Desktop\danielkahootbot-master\kahootlib.py", line 13, in waitForItem
WebDriverWait(driver, timeout).until(expected_conditions.visibility_of_element_located((By.CSS_SELECTOR, css)))
File "C:\Users\danil\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:

its happing while waiting between questions

how long is the wait between questions?

like one or two min it really depends

cant u just set the waitforitem timeout to 1000 ?

ok. So it is timing out after 30 seconds. I can add an option to change the default timeout period, because I have never seen a question that long.

yeah in school the teachers some times tell us about a question after we have answeared thats why

what would the effect be if you just removed the timeout ????

I added an option for changing the timeout to the KBOT file.

Thanks

change it to whatever value you need

would changeing the value to 300 have a bad side effect

I don't believe so. Initially I was using that value to check for if a question was skipped, but now it only checks how long to wait before skipping over a question. I now catch an elementnotvisible to check for skips.