Codeception / module-webdriver

WebDriver module for Codeception
MIT License
36 stars 24 forks source link

Set firefox options is not working #106

Open laoneo opened 3 years ago

laoneo commented 3 years ago

What are you trying to achieve?

Set download options in firefox similar to what we can do with chrome. See yaml below.

What do you get instead?

Options are empty in firefox browser when I open url about:config.

Details

Naktibalda commented 3 years ago

This isn't an issue of Codeception, Codeception just passes all capabilities to php-webdriver library, php-webdriver passes them to Selenium, Selenium passes them to Firefox.

Either you are setting capabilities in incorrect way or thereis a bug somewhere (most likely in Marionette Driver).

I did a quick search and all results suggest setting download options using Firefox Profile. https://www.toolsqa.com/selenium-webdriver/how-to-download-files-using-selenium/ https://stackoverflow.com/questions/41644381/python-set-firefox-preferences-for-selenium-download-location

I'm not familiar with Firefox profiles, but according to examples in documentation you have to create profile file and load it like this:

capabilities:
    unexpectedAlertBehaviour: 'accept'
    firefox_profile: '~/firefox-profiles/codeception-profile.zip.b64'
laoneo commented 3 years ago

Tried that but it doesn't load the profile, I'm not the only one as you can see in the comment here https://github.com/Codeception/Codeception/issues/1188#issuecomment-566019751. Any hint how this can be debugged why the profile is not loading?

laoneo commented 3 years ago

So the profile is sent to selenium, but no clue where to start there debugging the issue.

laoneo commented 3 years ago

I'm still on this one. How can I set the firefox profile in codeception as the example shows here for python https://stackoverflow.com/questions/18759762/firefox-selenium-webdriver-and-download-a-csv-file-automatically ?

Naktibalda commented 3 years ago

You can set firefox_profile to instance of FirefoxProfile class in by calling _capabilities method in Acceptance helper.

https://github.com/php-webdriver/php-webdriver/blob/33284ca385542df62a15ee53cc82eef33ca0c407/lib/Firefox/FirefoxProfile.php

https://codeception.com/docs/modules/WebDriver

laoneo commented 3 years ago

Can you confirm that firefox_profile works in your suite yaml? When I pass it then it arrives at selnium but it still uses an empty one.

Naktibalda commented 3 years ago

I can't do that now. Looks like a bug of Selenium or Firefox.