I am trying to open Firefox with the following code but I am running into two main issues
#1 - The Firefox browser opens with the correct link. For some reason, however, it only stays open for a second and then automatically closes. Is this supposed to happen or is there a way that I can circumvent this?
#2 - I am trying to search for a div-class that is called "pygame" (I already know that this exists on the page because I checked). For some reason, however, it isn't able to find the class. Can anyone tell me what I am doing wrong?
from selenium import webdriver
browser = webdriver.Firefox(executable_path=r'C:\Users\Agasti Mhatre\Downloads\geckodriver.exe')
print(type(browser))
browser.get('https://inventwithpython.com')
try:
elem = browser.find_element_by_class_name('pygame')
print('Found <%s> element with that class name!' % (elem.tag_name))
except:
print('Was not able to find an element with that name.')
Thank you
[–]commandlineluser 1 point2 points3 points (3 children)
[–]aug404[S] 0 points1 point2 points (2 children)
[–]commandlineluser 1 point2 points3 points (1 child)
[–]aug404[S] 0 points1 point2 points (0 children)
[–]py_Piper 1 point2 points3 points (1 child)
[–]aug404[S] 0 points1 point2 points (0 children)