Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'module' object has no attribute 'FireFox' #3

Closed
ignamiranda opened this issue Apr 1, 2020 · 4 comments
Closed

AttributeError: 'module' object has no attribute 'FireFox' #3

ignamiranda opened this issue Apr 1, 2020 · 4 comments

Comments

@ignamiranda
Copy link

Could you elaborate what you mean here?

You'll have to update the path of the this installed webdriver under: python driver = webdriver.Chrome() if its not the default location your OS needs. Similarly, for FireFox python driver = webdriver.FireFox()

I'm not very experienced with Python and I get this error. I already put geckodriver.exe in my PATH.

Traceback (most recent call last):
  File "C:/Users/ignam/Desktop/Whole-Foods-Delivery-Slot-master/whole_foods_delivery_slot_firefox.py", line 46, in <module>
    getWFSlot('https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1')
  File "C:/Users/ignam/Desktop/Whole-Foods-Delivery-Slot-master/whole_foods_delivery_slot_firefox.py", line 11, in getWFSlot
    driver = webdriver.FireFox()
AttributeError: 'module' object has no attribute 'FireFox'
@pcomputo
Copy link
Owner

pcomputo commented Apr 2, 2020

can you please pull the latest changes and check?
You'll have to change it to driver = webdriver.Firefox()

@ignamiranda
Copy link
Author

That fixed it! Thanks!

@ignamiranda
Copy link
Author

ignamiranda commented Apr 2, 2020

Spoke too soon. The firefox window opened fine and I'm still waiting to see if it notifies correctly. But in the terminal I got:

C:/Users/ignam/Desktop/Whole-Foods-Delivery-Slot-master/whole_foods_delivery_slot_firefox.py:14: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("html.parser"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

The code that caused this warning is on line 14 of the file C:/Users/ignam/Desktop/Whole-Foods-Delivery-Slot-master/whole_foods_delivery_slot_firefox.py. To get rid of this warning, pass the additional argument 'features="html.parser"' to the BeautifulSoup constructor.

  soup = bs4.BeautifulSoup(html)
Traceback (most recent call last):
  File "C:/Users/ignam/Desktop/Whole-Foods-Delivery-Slot-master/whole_foods_delivery_slot_firefox.py", line 46, in <module>
    getWFSlot('https://www.amazon.com/gp/buy/shipoptionselect/handlers/display.html?hasWorkingJavascript=1')
  File "C:/Users/ignam/Desktop/Whole-Foods-Delivery-Slot-master/whole_foods_delivery_slot_firefox.py", line 19, in getWFSlot
    driver.refresh()
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 831, in refresh
    self.execute(Command.REFRESH)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchWindowException: Message: Browsing context has been discarded

@pcomputo
Copy link
Owner

pcomputo commented Apr 2, 2020

It's working correctly on my Firefox. Can you try running it once again?
Also, make sure you don't shut the Firefox window till it shuts itself.

Can you also post your Firefox version?

@pcomputo pcomputo closed this as completed Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants