Skip to content

Commit 4003462

Browse files
authored
Merge pull request #1854 from emanlove/fix-remote-options-edge-safari-1844
Fix remote options edge safari 1844
2 parents f3643ef + 2b0aace commit 4003462

14 files changed

Lines changed: 28 additions & 368 deletions

atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ ${event_firing_or_none} ${NONE}
1212
Open Browser To Start Page
1313
[Tags] NoGrid
1414
[Documentation]
15-
... LOG 1:37 DEBUG Wrapping driver to event_firing_webdriver.
16-
... LOG 1:39 INFO Got driver also from SeleniumLibrary.
15+
... LOG 1:20 DEBUG Wrapping driver to event_firing_webdriver.
16+
... LOG 1:22 INFO Got driver also from SeleniumLibrary.
1717
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
1818
... desired_capabilities=${DESIRED_CAPABILITIES}
1919

atest/acceptance/create_webdriver.robot

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Library Collections
77
Create Webdriver Creates Functioning WebDriver
88
[Documentation]
99
... LOG 1:1 INFO REGEXP: Creating an instance of the \\w+ WebDriver.
10-
... LOG 1:25 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+.
10+
... LOG 1:8 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+.
1111
[Tags] Known Issue Internet Explorer Known Issue Safari
1212
[Setup] Set Driver Variables
1313
Create Webdriver ${DRIVER_NAME} kwargs=${KWARGS}
@@ -42,8 +42,7 @@ Set Driver Variables
4242
Set Test Variable ${DRIVER_NAME} ${name}
4343
${dc names}= Create Dictionary ff=FIREFOX firefox=FIREFOX ie=INTERNETEXPLORER
4444
... internetexplorer=INTERNETEXPLORER googlechrome=CHROME gc=CHROME
45-
... chrome=CHROME htmlunit=HTMLUNIT htmlunitwithjs=HTMLUNITWITHJS
46-
... safari=SAFARI headlessfirefox=FIREFOX headlesschrome=CHROME
45+
... chrome=CHROME safari=SAFARI headlessfirefox=FIREFOX headlesschrome=CHROME
4746
${dc name}= Get From Dictionary ${dc names} ${BROWSER.lower().replace(' ', '')}
4847
${caps}= Evaluate selenium.webdriver.DesiredCapabilities.${dc name}
4948
... modules=selenium, selenium.webdriver

atest/acceptance/keywords/location.robot

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ Wait Until Location Is Not Fails With Timeout
112112

113113
Wait Until Location Is Not Fails With Message
114114
[Setup] Go To Page "javascript/wait_location.html"
115+
Sleep 1s # Make sure you don't check too soon
115116
${orig_timeout}= Set Selenium Timeout 2 s
116117
Run Keyword And Expect Error
117118
... my_message

atest/acceptance/keywords/page_load_timeout.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Test Teardown Close Browser And Reset Page Load Timeout
77
*** Test Cases ***
88
Should Open Browser With Default Page Load Timeout
99
[Documentation] Verify that 'Open Browser' changes the page load timeout.
10-
... LOG 1.1.1:33 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000}
11-
... LOG 1.1.1:35 DEBUG STARTS: Remote response: status=200
10+
... LOG 1.1.1:16 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000}
11+
... LOG 1.1.1:18 DEBUG STARTS: Remote response: status=200
1212
Open Browser To Start Page
1313

1414
Should Run Into Timeout Exception

atest/acceptance/keywords/screenshots_embed.robot

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ Capture Page Screenshot Override EMBED
3838
[Setup] Remove .png Files
3939
Set Screenshot Directory EMBED
4040
${file}= Capture Page Screenshot override-embed-screenshot.png
41-
Should Be Equal ${file} ${OUTPUTDIR}/override-embed-screenshot.png
42-
File Should Exist ${OUTPUTDIR}/override-embed-screenshot.png
43-
File Should Not Exist ${EXECDIR}/*.png
44-
File Should Not Exist ${EXECDIR}/EMBED/*.png
41+
Should Be Equal ${file} ${OUTPUTDIR}${/}override-embed-screenshot.png
42+
File Should Exist ${OUTPUTDIR}${/}override-embed-screenshot.png
43+
File Should Not Exist ${EXECDIR}${/}*.png
44+
File Should Not Exist ${EXECDIR}${/}EMBED${/}*.png
4545

4646
*** Keywords ***
4747
Remove .png Files

atest/acceptance/multiple_browsers_options.robot

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,32 @@ Documentation Creating test which would work on all browser is not possible.
99
*** Test Cases ***
1010
Chrome Browser With Selenium Options As String
1111
[Documentation]
12-
... LOG 1:20 DEBUG GLOB: *"goog:chromeOptions"*
13-
... LOG 1:20 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
12+
... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"*
13+
... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
1414
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
1515
... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("--disable-dev-shm-usage")
1616

1717
Chrome Browser With Selenium Options As String With Attirbute As True
1818
[Documentation]
19-
... LOG 1:20 DEBUG GLOB: *"goog:chromeOptions"*
20-
... LOG 1:20 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
21-
... LOG 1:20 DEBUG GLOB: *"--headless"*
19+
... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"*
20+
... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
21+
... LOG 1:3 DEBUG GLOB: *"--headless"*
2222
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
2323
... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; headless = True
2424

2525
Chrome Browser With Selenium Options With Complex Object
2626
[Tags] NoGrid
2727
[Documentation]
28-
... LOG 1:20 DEBUG GLOB: *"goog:chromeOptions"*
29-
... LOG 1:20 DEBUG GLOB: *"mobileEmulation": {"deviceName": "Galaxy S5"*
30-
... LOG 1:20 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
28+
... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"*
29+
... LOG 1:3 DEBUG GLOB: *"mobileEmulation": {"deviceName": "Galaxy S5"*
30+
... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
3131
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
3232
... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; add_experimental_option( "mobileEmulation" , { 'deviceName' : 'Galaxy S5'})
3333

3434
Chrome Browser With Selenium Options Object
3535
[Documentation]
36-
... LOG 2:20 DEBUG GLOB: *"goog:chromeOptions"*
37-
... LOG 2:20 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
36+
... LOG 2:3 DEBUG GLOB: *"goog:chromeOptions"*
37+
... LOG 2:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
3838
${options} = Get Chrome Options
3939
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
4040
... desired_capabilities=${DESIRED_CAPABILITIES} options=${options}
@@ -47,7 +47,7 @@ Chrome Browser With Selenium Options Invalid Method
4747

4848
Chrome Browser With Selenium Options Argument With Semicolon
4949
[Documentation]
50-
... LOG 1:20 DEBUG GLOB: *"goog:chromeOptions"*
51-
... LOG 1:20 DEBUG GLOB: *["has;semicolon"*
50+
... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"*
51+
... LOG 1:3 DEBUG GLOB: *["has;semicolon"*
5252
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
5353
... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("has;semicolon")

atest/acceptance/open_and_close.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Close Browser Does Nothing When No Browser Is Opened
1616

1717
Browser Open With Not Well-Formed URL Should Close
1818
[Documentation] Verify after incomplete 'Open Browser' browser closes
19-
... LOG 1.1:41 DEBUG STARTS: Opened browser with session id
20-
... LOG 1.1:41 DEBUG REGEXP: .*but failed to open url.*
19+
... LOG 1.1:24 DEBUG STARTS: Opened browser with session id
20+
... LOG 1.1:24 DEBUG REGEXP: .*but failed to open url.*
2121
... LOG 2:2 DEBUG STARTS: DELETE
2222
... LOG 2:5 DEBUG STARTS: Finished Request
2323
Run Keyword And Expect Error * Open Browser bad.url.bad ${BROWSER}

src/SeleniumLibrary/keywords/browsermanagement.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ def open_browser(
8383
| Internet Explorer | internetexplorer, ie |
8484
| Edge | edge |
8585
| Safari | safari |
86-
| Iphone | iphone |
87-
| PhantomJS | phantomjs |
88-
| HTMLUnit | htmlunit |
89-
| HTMLUnit with Javascript | htmlunitwithjs |
9086
9187
To be able to actually use one of these browsers, you need to have
9288
a matching Selenium browser driver available. See the
@@ -140,9 +136,7 @@ def open_browser(
140136
are available. Please note that not all browsers, supported by the
141137
SeleniumLibrary, have Selenium options available. Therefore please
142138
consult the Selenium documentation which browsers do support
143-
the Selenium options. If ``browser`` argument is `android` then
144-
[https://seleniumhq.github.io/selenium/docs/api/py/webdriver_chrome/selenium.webdriver.chrome.options.html#selenium.webdriver.chrome.options.Options|Chrome options]
145-
is used. Selenium options are also supported, when ``remote_url``
139+
the Selenium options. Selenium options are also supported, when ``remote_url``
146140
argument is used.
147141
148142
The SeleniumLibrary ``options`` argument accepts Selenium
@@ -362,9 +356,6 @@ def create_webdriver(
362356
| ${proxy}= | `Evaluate` | selenium.webdriver.Proxy() | modules=selenium, selenium.webdriver |
363357
| ${proxy.http_proxy}= | `Set Variable` | localhost:8888 | |
364358
| `Create Webdriver` | Firefox | proxy=${proxy} | |
365-
| # Use proxy with PhantomJS | | | |
366-
| ${service args}= | `Create List` | --proxy=192.168.132.104:8888 | |
367-
| `Create Webdriver` | PhantomJS | service_args=${service args} | |
368359
369360
Returns the index of this browser instance which can be used later to
370361
switch back to it. Index starts from 1 and is reset back to it when

src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py

Lines changed: 2 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ class WebDriverCreator:
5353
"internetexplorer": "ie",
5454
"edge": "edge",
5555
"safari": "safari",
56-
"phantomjs": "phantomjs",
57-
"htmlunit": "htmlunit",
58-
"htmlunitwithjs": "htmlunit_with_js",
59-
"android": "android",
60-
"iphone": "iphone",
6156
}
6257

6358
def __init__(self, log_dir):
@@ -307,7 +302,7 @@ def create_edge(
307302
desired_capabilities = self._remote_capabilities_resolver(
308303
desired_capabilities, defaul_caps
309304
)
310-
return self._remote(desired_capabilities, remote_url)
305+
return self._remote(desired_capabilities, remote_url, options=options)
311306
if not executable_path:
312307
executable_path = self._get_executable_path(webdriver.edge.service.Service)
313308
service = EdgeService(executable_path=executable_path, log_path=service_log_path)
@@ -330,112 +325,12 @@ def create_safari(
330325
desired_capabilities = self._remote_capabilities_resolver(
331326
desired_capabilities, defaul_caps
332327
)
333-
return self._remote(desired_capabilities, remote_url)
328+
return self._remote(desired_capabilities, remote_url, options=options)
334329
if not executable_path:
335330
executable_path = self._get_executable_path(webdriver.Safari)
336331
service = SafariService(executable_path=executable_path, log_path=service_log_path)
337332
return webdriver.Safari(options=options, service=service)
338333

339-
def create_phantomjs(
340-
self,
341-
desired_capabilities,
342-
remote_url,
343-
options=None,
344-
service_log_path=None,
345-
executable_path="phantomjs",
346-
):
347-
warnings.warn(
348-
"SeleniumLibrary support for PhantomJS has been deprecated, "
349-
"please use headlesschrome or headlessfirefox instead."
350-
)
351-
if remote_url:
352-
defaul_caps = webdriver.DesiredCapabilities.PHANTOMJS.copy()
353-
desired_capabilities = self._remote_capabilities_resolver(
354-
desired_capabilities, defaul_caps
355-
)
356-
return self._remote(desired_capabilities, remote_url)
357-
if options:
358-
logger.warn("PhantomJS browser does not support Selenium options.")
359-
if not executable_path:
360-
executable_path = self._get_executable_path(webdriver.PhantomJS)
361-
return webdriver.PhantomJS(
362-
service_log_path=service_log_path,
363-
executable_path=executable_path,
364-
**desired_capabilities,
365-
)
366-
367-
def create_htmlunit(
368-
self,
369-
desired_capabilities,
370-
remote_url,
371-
options=None,
372-
service_log_path=None,
373-
executable_path=None,
374-
):
375-
if service_log_path or options or executable_path:
376-
logger.warn(
377-
"Htmlunit does not support Selenium options, service_log_path or executable_path argument."
378-
)
379-
defaul_caps = webdriver.DesiredCapabilities.HTMLUNIT.copy()
380-
desired_capabilities = self._remote_capabilities_resolver(
381-
desired_capabilities, defaul_caps
382-
)
383-
return self._remote(desired_capabilities, remote_url, options=options)
384-
385-
def create_htmlunit_with_js(
386-
self,
387-
desired_capabilities,
388-
remote_url,
389-
options=None,
390-
service_log_path=None,
391-
executable_path=None,
392-
):
393-
if service_log_path or options or executable_path:
394-
logger.warn(
395-
"Htmlunit with JS does not support Selenium options, service_log_path or executable_path argument."
396-
)
397-
defaul_caps = webdriver.DesiredCapabilities.HTMLUNITWITHJS.copy()
398-
desired_capabilities = self._remote_capabilities_resolver(
399-
desired_capabilities, defaul_caps
400-
)
401-
return self._remote(desired_capabilities, remote_url, options=options)
402-
403-
def create_android(
404-
self,
405-
desired_capabilities,
406-
remote_url,
407-
options=None,
408-
service_log_path=None,
409-
executable_path=None,
410-
):
411-
if service_log_path or executable_path:
412-
logger.warn(
413-
"Android does not support Selenium options or executable_path argument."
414-
)
415-
defaul_caps = webdriver.DesiredCapabilities.ANDROID.copy()
416-
desired_capabilities = self._remote_capabilities_resolver(
417-
desired_capabilities, defaul_caps
418-
)
419-
return self._remote(desired_capabilities, remote_url, options=options)
420-
421-
def create_iphone(
422-
self,
423-
desired_capabilities,
424-
remote_url,
425-
options=None,
426-
service_log_path=None,
427-
executable_path=None,
428-
):
429-
if service_log_path or executable_path:
430-
logger.warn(
431-
"iPhone does not support service_log_path or executable_path argument."
432-
)
433-
defaul_caps = webdriver.DesiredCapabilities.IPHONE.copy()
434-
desired_capabilities = self._remote_capabilities_resolver(
435-
desired_capabilities, defaul_caps
436-
)
437-
return self._remote(desired_capabilities, remote_url, options=options)
438-
439334
def _remote(self, desired_capabilities, remote_url, profile_dir=None, options=None):
440335
remote_url = str(remote_url)
441336
file_detector = self._get_sl_file_detector()
@@ -620,8 +515,6 @@ def create(self, browser, options):
620515
return selenium_options
621516

622517
def _import_options(self, browser):
623-
if browser == "android":
624-
browser = "chrome" # Android uses ChromeOptions()
625518
browser = browser.replace("headless_", "", 1)
626519
options = importlib.import_module(f"selenium.webdriver.{browser}.options")
627520
return options.Options

0 commit comments

Comments
 (0)