Repository navigation
Headless Firefox and Chrome support - #1011
Conversation
|
This change depends on changes made to Selenium 3.8.0. |
|
I can update the Travis configuration to have Selenium 3.8.0. When that is done, you can rebase with the master. Then some questions
|
|
Awesome! Don't have time to go through or test the changes, but some general comments/questions:
|
|
I don't think this needs separate tests. We just need to run all tests with supported headless browsers on CI. If there are some tests that don't pass with headless, they can be excluded with tags like we already do with other browser incompatibilities. |
|
With Chrome tests stats look like this: Which I guess is considered that all tests passed. Firefox tests get stuck on Headless Chrome stats look like this: One webdriver test fails because headlesschrome is not expected browser name. Marionette seems to die every time with Firefox Headless at some point of the test run. Or at least that's what I think Yes, also remote works. My thinking was that using different browser names for these makes it really simple to start using headless browsers in existing test setups just by issuing -variable BROWSER:headlessfirefox and things would work for most scenarios. Having this as a extra arg for Open Browser would in some cases be nicer, after all, those are not really different browsers. |
|
Test run is considered OK if all critical tests pass. If there are critical failures, need to investigate why they occur. If they cannot be fixed, they can be ignored by using tags.
Another approach is supporting if browser.upper().startswith('HEADLESS'):
browser = browser[len('HEADLESS'):]
headless = True |
|
It seems that update to Selenium 3.8.0 does make two of our acceptance tests fail. I need to take a closer look where the error is and fix it. See #1012 for details about Selenium 3.8.0 update. |
|
Adding I agree that it would be really nice to build the support for future headless browsers right away, it just feels weird. For example how should PhantomJS react to headless=True/False? What should be built for IE, which most probably will not ever get headless support? For me it feels cleanest to only support existing features. Also it is convenient to handle headless browsers as different browsers, since most tooling already allow specifying the browsers, not adding artificial arguments. Yes, it probably means extra work if and when Egde, Android and Safari get headless support. |
|
Selenium 3.8.0 raises different type of exception with JavaScript and #1013 fixes this problem. |
|
The referred implementation at Harri/SeleniumLibrary@8222852 is indeed somewhat complicated and there's lot of repetition. A lot simpler solution would be adding if is_truthy(headless):
options.set_headless()All functions calling this should obviously then pass |
|
https://github.com/SeleniumHQ/selenium/blob/master/py/selenium/webdriver/__init__.py has [browser]Options imported only for Firefox, Chrome and WebKitGTK. So in addition to checking whether And if/when in the future EdgeOptions() is a things, it will most probably be named EgdeOptions() but that's not sure. |
| [https://github.com/robotframework/SeleniumLibrary#browser-drivers| | ||
| project documentation] for more details. | ||
| project documentation] for more details. Headless Firefox and | ||
| Headless Google Chrome require Selenium 3.8.0 or newer. |
There was a problem hiding this comment.
Should also mention that they are new in SeleniumLibrary 3.x.x, depending on which version this is going to be added.
There was a problem hiding this comment.
Lets put this to the 3.1.0 release.
| options.set_headless() | ||
| return self._generic_make_driver( | ||
| webdriver.Chrome, webdriver.DesiredCapabilities.CHROME, remote, | ||
| desired_capabilities, options=options) |
There was a problem hiding this comment.
Calling _make_chrome here like _make_ff is called by _make_headless_ff above would probably be a good idea especially for consistency reasons.
|
Trying to make the code too future-proof isn't a good idea. Better to just concentrate on Chrome and Firefox that actually work. I took a bit more closer look at the changes and they are very simple. Added few line notes and have these general questions/comments as well:
|
|
|
I've started to thing |
|
The 3.0.1 is out. But this feature is requested often within the users of the SeleniumLibrary. We could make next a 3.1.0 which contains this feature and possible some other enhancement if they are ready when this PR is merged to master. Created issue #1014 to cover this PR. |
|
I did test the PR with local browser in Ubuntu.
Todo:
But in any case, I am loving the feature because now I can run acceptance test locally and same time do something else too. |
|
It is true that doing this from command line: |
|
I'm just getting started using Robot but I'd vote for one argument as well. Then I can simply change one line in my test / automation code vs having to add things for a new 'headless' argument. ${BROWSER} chrome |
|
Now only "headless chrome" and "headless firefox" are valid headless browser names, so ff, gc and google chrome were dropped. If those need to be added back, let me know. Sorry for the delay. It was weekend and surly a good time to catch a flu. |
|
No problems, the 3.0.1 is out to fix the immediate problem in the 3.0.0 release and this is targeted to the 3.1.0 release. The 3.1.0 is planned to be out before Christmas. I did read the code from a mobile screen, but I need to take a closer look from a bigger screen, because I miss stuff from the smaller screen. |
| 'safari': "_make_safari", | ||
| 'edge': "_make_edge" | ||
| 'edge': "_make_edge", | ||
| 'headlessfirefox': '_make_headless_ff', |
There was a problem hiding this comment.
I think we need to support only for headlessfirefox and headlesschrome.
|
I only had one commit and then this should be ready to merged to master. |
|
I don't know why the tests failed. The error message is "No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.". On my local machine things are ok and the latest diff could not cause that kind of issue where no output was generated. |
|
I think the Firefox got stuck at something and then Travis will kill the job after 10mins of the inactivity. I did restart the FF job and let's see how it goes. Other reason might be that Travis has updated their environments, yesterday, and it might have broken something. |
|
Looks like this has something to do with the Travis update or it might be that Firefox is behaving badly. I will try to figure out what is making the Travis to fail the tests Firefox. |
|
I changed the Travis configuration to run with previous version of the Trusty image and then tests started to pass. Because failure in Travis this is not related to this PR, I am merging the code the master. |
This PR adds headless Firefox and Chrome support for
Open Browserkeyword. It adds two browsers; Headless Firefox and Headless Google Chrome with couple aliases.This allows us to write tests like this: