How to share GEO-Location or load custom profile: CHROME

1,094 views
Skip to first unread message

Igor Radovanovic

unread,
Nov 13, 2015, 9:59:17 AM11/13/15
to robotframework-users
Hi, everyone.
It is my first time to write in this group and I hope that I would get some good feedbacks. As I could see a lot of god developers and testers are here. :)

So, I have the following problem:
- in our application, among other things, we are using geo-location (current position). But when the robot starts CHROME browser it starts as new instance of chrome with default (or incognito, I don't know) settings. So although I have set up "always share location" it will ask for sharing location.
Robot by itself, has not possibilities to handle that window, also is not possible to go with the robot in chrome://settings and set then. ( page is html, I had to try :) ) 

Only when I was close is if i try to run browser like this:

def open_custom_chrome(config, user_dir):
chrome_option = Options()
chrome_option._experimental_options['prefs'] = config
chrome_option.add_argument("user-data-dir=" + user_dir)

driver = webdriver.Chrome(executable_path="C:/webdriver/32/chromedriver", chrome_options=chrome_option)
driver.get('http://www.google.com/')

In config i provide something like this intl.accept_languages=en_us  which is working, and also CHROME will start with my settings (extensions and so on) but problem is then that i can't do nothing more with browser.
Also this driver.get('google.com") is ignored. Just empty page.

HELP! :)

Wladislaw Wagner

unread,
Nov 13, 2015, 1:45:02 PM11/13/15
to igo...@gmail.com, robotframework-users
Are u getting any errors? Plz provide log, stack trace or any other more detailed information to analyze.

Cheers
Tset

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Tset Noitamotua

unread,
Nov 13, 2015, 4:46:28 PM11/13/15
to robotframework-users
OFFTOPiC - @Igor: how you get this nice formatting for code block and inline code here?

Cheers
Tset

Igor Radovanovic

unread,
Nov 14, 2015, 7:00:41 AM11/14/15
to robotframework-users
There is no error. Just test continue with execution and then fail if some element is not found (of course is not found because URL is not right)

P.S. You have button { }  highlight code syntax (and i copy/paste from my IDE)

Igor Radovanovic

unread,
Nov 16, 2015, 3:39:16 AM11/16/15
to robotframework-users
Ok. So I try to run this:

Open Custom Chrome
Go To                     ${inputUrl}

///file.py                                     
def open_custom_chrome():

lang = webdriver.ChromeOptions()
lang.add_argument("--lang=en")
chrome = webdriver.Chrome(chrome_options=lang)
chrome.get('http://www.google.com/xhtml')




So, browser is opening and is going to google but Go To command can not be executed.
Actualy error is : 
FAILNo browser is open So, somehow something strange happens and robot can't see browser

Tatu Aalto

unread,
Nov 17, 2015, 1:52:30 AM11/17/15
to igo...@gmail.com, robotframework-users

Ugh

You are almost getting it right, but you are missing few crucial parts. The main problem is that the webdriver instance only lives inside of that keyword and you must save the webdriver instance to the Selenium2Library instance (created by Robot Framework).

1) Get the S2L instance from Robot Framework [1].
2) Create the webdriver instance, like in your code.
3) Save the webdriver instance to the S2L instance. In S2L code, webdriver instance is usually referred as browser. There is not a public interface in S2L to save the webdriver instance, so you must rely on the private interface, but that has been stable for years and is safe to use. Read the Open Browser keyword code for good example how to save the webdriver instance.

If you encounter problems, don't hesitate to ask.

-Tatu
Send from my mobile
[1] http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#getting-active-library-instance-from-robot-framework

--

Tset Noitamotua

unread,
Nov 17, 2015, 3:40:14 AM11/17/15
to robotframework-users, igo...@gmail.com
@Igor: Do you really need your custom library or did you make it just to start a custom Chrome instance with options?
May be it is easier to translate your custom keyword into Robot Framework syntax and then you could contiunue to write your test with default Selenium2Library keywords e.g.:

| Open URL in Google Chrome | [Arguments] | ${url}
| | [Documentation] | Starts the Google Chrome browser.
| | ${options}= | Evaluate | sys.modules['selenium.webdriver'].ChromeOptions() | sys
| | Call Method | ${options} | add_argument | --lang\=ru
| | Create WebDriver | Chrome | chrome_options=${options} | executable_path=C:/webdriver/32/chromedriver
| | Go To | ${url}
| | Maximize Browser Window
| | # and so on

Cheers
Tset
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

Igor Radovanovic

unread,
Nov 17, 2015, 4:07:16 AM11/17/15
to robotframework-users, igo...@gmail.com
Hmm... tnx. 
This has sense.
Now, problem is that i can't create instance (i don't know how) of webdriver. Because with webdriver.ChromeOptions() is only way that I really could set chrome options.
Suggestion?
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

Igor Radovanovic

unread,
Nov 17, 2015, 4:10:29 AM11/17/15
to robotframework-users, igo...@gmail.com
@Tset. I haven't seen your last post.

For me is important that i can run chrome with my config. user-data-dir is most important argument which I need. If could work in robot, perfect. But when i tried to use like this

${options}= | Evaluate | sys.modules['selenium.webdriver'].ChromeOptions() | sys

this option was ignored :s

But i could try again.

Igor Radovanovic

unread,
Nov 17, 2015, 4:24:20 AM11/17/15
to robotframework-users
So, @Tset if I try your example is working, if i try this:

${options}=          Evaluate       sys.modules['selenium.webdriver'].ChromeOptions()   sys
Call Method          ${options}      add_argument        --user-data-dir\=C:/Users/.../Local/Google/Chrome/User Data
Create WebDriver     Chrome         chrome_options=${options}   executable_path=C:/webdriver/32/chromedriver
Go To ${url}

then is not working. The browser is opened, and is opened correctly (i can see all my plugins, my user) but just open, no change URL. Url is empty.

Tset Noitamotua

unread,
Nov 17, 2015, 6:24:22 AM11/17/15
to robotframework-users
How do you call the keyword?

e.g.

*** Test Cases***
| Simple Test
| | Open URL in Google Chrome | http://www.google.com
| | Wait until Page Contains  | xpath=//img[@title='Google']
| | # continue here with other Selenium2Library keywords

Cheers
Tset

Igor Radovanovic

unread,
Nov 17, 2015, 6:43:41 AM11/17/15
to robotframework-users
That my code is directly located into Suite Setup

Wladislaw Wagner

unread,
Nov 17, 2015, 1:43:29 PM11/17/15
to igo...@gmail.com, robotframework-users
I guess we need more details to be able to help. sometimes it is a matter of a single sign which makes a code work or fail.
If possible please provide a concrete code example (modify it so it does not reveal sensible data) + provide information from Robot Framework log.html after test run. Execute tests with debug level TRACE like this:

pybot -L TRACE yourtest.robot


Cheers
Tset
Igor Radovanovic <igo...@gmail.com> schrieb am Di., 17. Nov. 2015 um 12:43:
That my code is directly located into Suite Setup

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

Igor Radovanovic

unread,
Nov 18, 2015, 1:44:57 AM11/18/15
to robotframework-users, igo...@gmail.com
Sure. Tnx for wanted to help.
Is like this.

I run test like this:
patest.bat testsuites\notification\createAndAcceptNotification.robot
[I run this from IDE and never saw any error, until now when I run from terminal - but this error shouldn't have anything with my problem]
TERMINAL OUTPUT:
Robot Framework remote server at 127.0.0.1:8270 starting.
[PID:7740] EXECUTING createAndAcceptNotification
[11012:3512:1118/072930:ERROR:cache_util_win.cc(20)] Unable to move the cache: 0
[11012:3512:1118/072930:ERROR:cache_util.cc(132)] Unable to move cache folder C:\Users\iradovanovic\AppData\Local\Google\Chrome\User Data\ShaderCache\GPUCache to C:\Users\iradovanovic\AppData\Local\Google\Chrome\User Data\ShaderC
ache\old_GPUCache_000
[11012:3512:1118/072930:ERROR:cache_creator.cc(132)] Unable to create cache
[11012:3512:1118/072930:ERROR:shader_disk_cache.cc(588)] Shader Cache Creation failed: -2
[PID:7740] still running createAndAcceptNotification after 15.0 seconds
[PID:7740] still running createAndAcceptNotification after 30.0 seconds
[PID:7740] still running createAndAcceptNotification after 45.0 seconds
[PID:7740] still running createAndAcceptNotification after 60.0 seconds
FAILED createAndAcceptNotification


My testsuite/case is like this:
*** Settings ***
Documentation       Restructured Testsuite
Resource testcases/notification/createAndAcceptNotification.robot

Variables resources/TestsysVar.py

Suite Setup SuiteConfiguration
Suite Teardown SuiteTeardown

*** Variables ***


*** Test Cases ***

Scenario: Create And Accept Custom Notification
[Tags] critical
TC-Create Custom Notification

*** Keywords ***

SuiteConfiguration
[Documentation] Open Browser and Login
${valuesetname}= Acquire Value Set
${browser}= Get Value From Set browser
${server}= Get Value From Set server

Set Suite Variable ${browser}
Set Suite Variable ${server}
${CC}= Get From Dictionary ${${server}} CC
${LIVE}= Get From Dictionary ${${server}} LIVE
${API}= Get From Dictionary ${${server}} API
${URL}= Get From Dictionary ${${server}} LOGIN

    ${options}=          Evaluate       sys.modules['selenium.webdriver'].ChromeOptions()   sys
    Call Method          ${options}      add_argument        user-data-dir\=C:/Users/iradovanovic/AppData/Local/Google/Chrome/User Data
Create WebDriver Chrome chrome chrome_options=${options} executable_path=C:/webdriver/32/chromedriver
${webdrive}= Get Webdriver Instance
Log ${webdrive}
Go To ${url}

Login @{customer}
Choose Authentication Profile 1
Confirm Password @{customer}[1]

Set Suite Variable ${CC}
Set Suite Variable ${LIVE}
Set Suite Variable ${API}

SuiteTeardown
[Documentation] When suite ends or fail
Close All Browsers
Release Value Set



Please, let me know if i forget something. 




Message has been deleted

Igor Radovanovic

unread,
Nov 18, 2015, 1:49:30 AM11/18/15
to robotframework-users, igo...@gmail.com
Aham, so behavior is: Chrome will open - so no "default" chrome with profile User1, but will browser same look and config as if I would open NEW WINDOW from my current browser. But URL is EMPTY (also no: data;  . as usually is in other cases )


On Wednesday, November 18, 2015 at 7:44:57 AM UTC+1, Igor Radovanovic wrote:
Sure. Tnx for wanted to help.
Is like this.
.....


Tset Noitamotua

unread,
Nov 18, 2015, 9:04:51 AM11/18/15
to robotframework-users, igo...@gmail.com
First thing I would try:

in this line

Call Method          ${options}      add_argument        user-data-dir\=C:/Users/iradovanovic/AppData/Local/Google/Chrome/User Data

change user-date-dir\=... to   --user-data-dir\=C:/Users/iradovanovic/AppData/Local/Google/Chrome/User Data
Note the two -- before user-date-dir

Cheers
Tset

Igor Radovanovic

unread,
Nov 18, 2015, 9:24:12 AM11/18/15
to robotframework-users, igo...@gmail.com
Ah, sorry. Yes. That was with --. Then i tried without and forget to revert. The behaviour is the same.

Wladislaw Wagner

unread,
Nov 18, 2015, 10:49:17 AM11/18/15
to igo...@gmail.com, robotframework-users
Please provide the log again after run with two --


Igor Radovanovic

unread,
Nov 19, 2015, 2:39:45 AM11/19/15
to robotframework-users, igo...@gmail.com



On Wednesday, November 18, 2015 at 4:49:17 PM UTC+1, Tset Noitamotua wrote:
Please provide the log again after run with two --


Igor Radovanovic <igo...@gmail.com> schrieb am Mi., 18. Nov. 2015 um 15:24:
Ah, sorry. Yes. That was with --. Then i tried without and forget to revert. The behaviour is the same.


On Wednesday, November 18, 2015 at 3:04:51 PM UTC+1, Tset Noitamotua wrote:
First thing I would try:

in this line

Call Method          ${options}      add_argument        user-data-dir\=C:/Users/iradovanovic/AppData/Local/Google/Chrome/User Data

change user-date-dir\=... to   --user-data-dir\=C:/Users/iradovanovic/AppData/Local/Google/Chrome/User Data
Note the two -- before user-date-dir

Cheers
Tset



Am Mittwoch, 18. November 2015 07:49:30 UTC+1 schrieb Igor Radovanovic:
Aham, so behavior is: Chrome will open - so no "default" chrome with profile User1, but will browser same look and config as if I would open NEW WINDOW from my current browser. But URL is EMPTY (also no: data;  . as usually is in other cases )

On Wednesday, November 18, 2015 at 7:44:57 AM UTC+1, Igor Radovanovic wrote:
Sure. Tnx for wanted to help.
Is like this.
.....


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

Wladislaw Wagner

unread,
Nov 19, 2015, 6:24:25 PM11/19/15
to igo...@gmail.com, robotframework-users
Hmmm, you are using robot remote server, right? Have you tried to run local?
Igor Radovanovic <igo...@gmail.com> schrieb am Do., 19. Nov. 2015 um 08:39:



On Wednesday, November 18, 2015 at 4:49:17 PM UTC+1, Tset Noitamotua wrote:
Please provide the log again after run with two --


Igor Radovanovic <igo...@gmail.com> schrieb am Mi., 18. Nov. 2015 um 15:24:
Ah, sorry. Yes. That was with --. Then i tried without and forget to revert. The behaviour is the same.


On Wednesday, November 18, 2015 at 3:04:51 PM UTC+1, Tset Noitamotua wrote:
First thing I would try:

in this line

Call Method          ${options}      add_argument        user-data-dir\=C:/Users/iradovanovic/AppData/Local/Google/Chrome/User Data

change user-date-dir\=... to   --user-data-dir\=C:/Users/iradovanovic/AppData/Local/Google/Chrome/User Data
Note the two -- before user-date-dir

Cheers
Tset



Am Mittwoch, 18. November 2015 07:49:30 UTC+1 schrieb Igor Radovanovic:
Aham, so behavior is: Chrome will open - so no "default" chrome with profile User1, but will browser same look and config as if I would open NEW WINDOW from my current browser. But URL is EMPTY (also no: data;  . as usually is in other cases )

On Wednesday, November 18, 2015 at 7:44:57 AM UTC+1, Igor Radovanovic wrote:
Sure. Tnx for wanted to help.
Is like this.
.....


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
Message has been deleted

Igor Radovanovic

unread,
Nov 20, 2015, 1:16:37 AM11/20/15
to robotframework-users, igo...@gmail.com
That thing I don't get. How (what) is looking remote robot or remote browser?

I use everything locally. Only Url is not localhost :)


On Friday, November 20, 2015 at 12:24:25 AM UTC+1, Tset Noitamotua wrote:
Hmmm, you are using robot remote server, right? Have you tried to run local?
Igor Radovanovic <igo...@gmail.com> schrieb am Do., 19. Nov. 2015 um 08:39:



On Wednesday, November 18, 2015 at 4:49:17 PM UTC+1, Tset Noitamotua wrote:
Please provide the log again after run with two --


Igor Radovanovic <igo...@gmail.com> schrieb am Mi., 18. Nov. 2015 um 15:24:
Ah, sorry. Yes. That was with --. Then i tried without and forget to revert. The behaviour is the same.


On Wednesday, November 18, 2015 at 3:04:51 PM UTC+1, Tset Noitamotua wrote:
First thing I would try:

in this line

Call Method          ${options}      add_argument        user-data-dir\=C:/Users/iradovanovic/AppData/Local/Google/Chrome/User Data

change user-date-dir\=... to   --user-data-dir\=C:/Users/iradovanovic/AppData/Local/Google/Chrome/User Data
Note the two -- before user-date-dir

Cheers
Tset



Am Mittwoch, 18. November 2015 07:49:30 UTC+1 schrieb Igor Radovanovic:
Aham, so behavior is: Chrome will open - so no "default" chrome with profile User1, but will browser same look and config as if I would open NEW WINDOW from my current browser. But URL is EMPTY (also no: data;  . as usually is in other cases )

On Wednesday, November 18, 2015 at 7:44:57 AM UTC+1, Igor Radovanovic wrote:
Sure. Tnx for wanted to help.
Is like this.
.....


--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

Wladislaw Wagner

unread,
Nov 21, 2015, 2:17:45 PM11/21/15
to igo...@gmail.com, robotframework-users
I saw "Robot Framework remote server at 127.0.0.1:8270 starting" in your terminal output above thats why I asumed that you are not using a lets say normal / default setup.

Ok. Lets go to the very beginning.
- Which Python version do you have?
- How did you installed Robot Framework?
- What does your setup looks like? Type "pip list" in your terminal an show us the output.
- What is the content of your patest.bat?

Cheers
Tset

To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.

Igor Radovanovic

unread,
Nov 23, 2015, 1:50:22 AM11/23/15
to robotframework-users, igo...@gmail.com
Ok.
So:
Python Version: Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)] on win32
- I install with PIP
- Pip list:
cssselect (0.9.1)
decorator (3.4.2)
docutils (0.12)
EasyProcess (0.1.9)
ecdsa (0.11)
lxml (3.3.3)
paramiko (1.15.2)
pip (6.0.6)
pycrypto (2.6)
Pygments (2.0.2)
pyquery (1.2.9)
requests (2.7.0)
robotframework (2.9.1)
robotframework-extendedselenium2library (0.4.8)
robotframework-pabot (0.15)
robotframework-requests (0.3.8)
robotframework-ride (1.4)
robotframework-selenium2library (1.7.1)
robotframework-sshlibrary (2.1.1)
robotframework-xvfb (1.0.1)
robotremoteserver (1.0.1)
run (0.2)
selenium (2.46.0)
setuptools (7.0)
xvfbwrapper (0.2.5)
[probably is not everythink from/for robot]

Content of pytests:

@echo off

REM ZEIT
set hour=%time:~0,2%
if "%hour:~0,1%" == " " set hour=0%hour:~1,1%
set min=%time:~3,2%
if "%min:~0,1%" == " " set min=0%min:~1,1%
set secs=%time:~6,2%
if "%secs:~0,1%" == " " set secs=0%secs:~1,1%
REM DATUM
set year=%date:~-4%
set month=%date:~3,2%
if "%month:~0,1%" == " " set month=0%month:~1,1%
set day=%date:~0,2%
if "%day:~0,1%" == " " set day=0%day:~1,1%
REM Set DateTime
set datetimef=%year%%month%%day%_%hour%-%min%-%secs%



pybot --outputdir=results\%year%_%month%_%day%\TestRun_%datetimef% ^
--variable RESOURCES:GlobalyVar ^
--loglevel=TRACE ^
%*

I hope that at the end somehow we will fix this frustrating problem.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

Tset Noitamotua

unread,
Nov 23, 2015, 8:58:15 AM11/23/15
to robotframework-users, igo...@gmail.com
Hi Igor,

I  finally found some time to try and reproduce the error. Unfortunately I am getting the same error. So I´m afraid that it is a real bug you have found either in Chrome webdriver or in Selenium OR it is a permission issue:
May be I have a workaround which I will post a little later.

Here is the test to reproduce the error on Windows (file igor.robot):

*** Settings ***
| Library | Selenium2Library

*** Variables ***

*** Test Cases ***
| Simple Test
| | Igors Keyword

*** Keywords ***
| Igors Keyword
| | [Documentation]  | Open Browser and Login
| | ${options}=      | Evaluate   | sys.modules['selenium.webdriver'].ChromeOptions() | sys
| | Call Method      | ${options} | add_argument | --user-data-dir\=C:/Users/username/AppData/Local/Google/Chrome/User Data
| | Create WebDriver | Chrome     | chrome_options=${options}
| | Go To | ${url}   |



Running above test with 'pybot -L TRACE igor.robot' leads to this error:

13:09:29.156FAILWebDriverException: Message: unknown error: Chrome failed to start: crashed (Driver info: chromedriver=2.20.353145 (343b531d31eeb933ec778dbcf7081628a1396067),platform=Windows NT 6.1 SP1 x86_64)
13:09:29.157DEBUGTraceback (most recent call last): File "<string>", line 2, in create_webdriver File "C:\Python27\lib\site-packages\Selenium2Library\keywords\keywordgroup.py", line 15, in _run_on_failure_decorator return method(*args, **kwargs) File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_browsermanagement.py", line 176, in create_webdriver driver = creation_func(**init_kwargs) File "C:\Python27\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 66, in __init__ keep_alive=True) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 87, in __init__ self.start_session(desired_capabilities, browser_profile) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 136, in start_session 'desiredCapabilities': desired_capabilities, File "C:\Python27\lib\site-packages\Selenium2Library\webdrivermonkeypatches.py", line 11, in execute result = self._base_execute(driver_command, params) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 196, in execute self.error_handler.check_response(response) File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 181, in check_response raise exception_class(message, screen, stacktrace)


Selenium2Library can be excluded as source of the error, because using pure selenium results in the same error:

C:\_GITHUB\igor>python
Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from selenium import webdriver
>>> option=webdriver.ChromeOptions()
>>> option.add_argument("--user-data-dir=C:/Users/userxy/AppData/Local/Google/Chrome/User Data")
>>> chrome = webdriver.Chrome(chrome_options=option)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 66, in __init__
    keep_alive=True)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 87, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 136, in start_session
    'desiredCapabilities': desired_capabilities,
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 196, in execute
    self.error_handler.check_response(response)
  File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 181, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
  (Driver info: chromedriver=2.20.353145 (343b531d31eeb933ec778dbcf7081628a1396067),platform=Windows NT 6.1 SP1 x86_64)

>>>


Cheers
Tset

Tset Noitamotua

unread,
Nov 23, 2015, 9:50:52 AM11/23/15
to robotframework-users
@Igor: concerning the error above you might ask in selenium user group[1] or open an issue on selenium github[2]

Here a little modification which works for me with Remote webdriver and selenium standalone server [3] (Note: my selenium server runs on a remote machine with it´s own chrome installed and it´s own chromedriver.exe on PATH).
WARNING: running this test twice (without closing the chrome browser after first run) leads to the same error 'Exception: unknown error: Chrome failed to start: crashed'  thats why I asume that it might be a permission issue when working with user profile.

content of igor.robot:

*** Settings ***
| Library | Selenium2Library

*** Variables ***
| ${URL} | http://www.google.com

*** Test Cases ***
| Simple Test
| | Open Remote Chrome  

*** Keywords ***
| Open Remote Chrome
| | [Documentation]  | Open Remote Browser

| | ${options}=      | Evaluate    | sys.modules['selenium.webdriver'].ChromeOptions() | sys
| | Call Method      | ${options}  | add_argument | --user-data-dir\=C:/Users/userxy/AppData/Local/Google/Chrome/User Data
| | ${options}       | Call Method | ${options} | to_capabilities
| | Create WebDriver | Remote      | command_executor=http://hostname:4444/wd/hub | desired_capabilities=${options}
| | Go To | ${url}
 

Test execution:



Another example you can find here[4]

I hope I could help you a little.

Cheers
Tset



[1] https://groups.google.com/forum/#!forum/selenium-users
[2] https://github.com/SeleniumHQ/selenium/issues
[3] http://www.seleniumhq.org/download/
[4] https://groups.google.com/forum/#!searchin/robotframework-users/chomre$20options/robotframework-users/gPsiVaMo19A/cBRH7mr2BAAJ
Auto Generated Inline Image 1

Igor Radovanovic

unread,
Nov 24, 2015, 1:54:19 AM11/24/15
to robotframework-users
Tnx Tset! Tnx a lot! This is helpful! Anyway, I will see to write to selenium group.

One more small thing. I was reading about REMOTE Chrome driver, over and over and i don't get how this is working.
Is that like this:
- i run my test on my local machines
- then i connect via IP to other Maschine and will run chrome from there (with that driver) (but this remote(d) driver should be on the same Maschine where is my selenium standalone server ?)
or?

I can't get what is remote driver. (I read documentation also this article [3])

Tset Noitamotua

unread,
Nov 26, 2015, 11:40:26 AM11/26/15
to robotframework-users
Here the promised 'How To': https://github.com/Tset-Noitamotua/_learnpython/wiki/HowTo:-Setup-Selenium-Standalone-Server-(remote)

I need to reupload the pictures, but I think it should also work without them.

Cheers
Tset

Igor Radovanovic

unread,
Nov 30, 2015, 3:41:07 AM11/30/15
to robotframework-users
Tnx. I will try now. :)

Igor Radovanovic

unread,
Dec 2, 2015, 2:58:08 AM12/2/15
to robotframework-users
@Tset, thank you man.

I tried with selenium standalone server and is working. But was strange for me, that is only working on VM and not in my local.

Then I figured out that also is working on VM without to use "REMOTE" keyword. I can use "custom config", I mean my chrome config, without REMOTE, and is working but only if i have no chrome opened. And also maybe if in configuration is not set that "open last opened tabs" (or something like that) . When you open browser with this, should be one tab. :)

Wladislaw Wagner

unread,
Dec 3, 2015, 12:42:38 PM12/3/15
to igo...@gmail.com, robotframework-users
@ Igor
I am glad to hear that you got it working!

Robot Framework rules ;-)

Cheers
Tset
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages