0
votes

i want to test desktop electron application via robotframework. I downloaded Selenium2Library and saw some article on internet about this. I create vars.py for variable with this text:

"chromeOptions": {
                   "binary": "/Users/amar/Downloads/name-of-application-staging.app/Contents/MacOS/name-of-application-staging",
                    "args": ["--headless", "--no-sandbox"]
               }
              

and test.robot:

*** Settings ***
Library    Selenium2Library
Variables    vars.py

*** Test Cases ***
Foo
  Create Webdriver    Remote    desired_capabilities=${binary_location}    command_executor=http://localhost:9515
  click element  hehe_element

First i run chromedriver, then go on in directory where test.robot is, then i type:

robot test.robot

and desktop app starts, and after like 30 seconds i get this error:

    WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
    (Driver info: chromedriver=2.43.600229 (3fae4d0cda5334b4f533bede5a4787f7b832d052), platform=Mac OS X 10.13.6 x86_64)

Second keyword "Click element" never starts.
I'm using macOS.

Version of chrome: `Version 70.0.3538.67 (Official Build) (64-bit)`

Version of chromedriver: `ChromeDriver 2.43`


After trying to start through .py i get this error:
     Traceback (most recent call last):
      File "start_application.py", line 11, in <module>
        browser = webdriver.Chrome(options=chrome_options)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
        desired_capabilities=desired_capabilities)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
        self.start_session(capabilities, browser_profile)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
        response = self.execute(Command.NEW_SESSION, parameters)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
        self.error_handler.check_response(response)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
        raise exception_class(message, screen, stacktrace)
    selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
      (Driver info: chromedriver=2.40.565386 (45a059dc425e08165f9a10324bd1380cc13ca363),platform=Mac OS X 10.13.6 x86_64)
1

1 Answers

0
votes

Try following code please :

def build_chrome_options():
    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument("--no-sandbox")
    chrome_options.add_argument("--headless")
    chromeOptions.binary_location='/Users/amar/Downloads/name-of-application-staging.app/Contents/MacOS/name-of-application-staging'

    return chrome_options 

If this code not solve your problem please see this issue from here.