Firefox profile when using Selenium2Library Java port

573 views
Skip to first unread message

Krzysztof Sokołowski

unread,
Jul 29, 2014, 3:18:38 AM7/29/14
to robotframe...@googlegroups.com
Hello.

I'm currently preparing Robot Framework environment which should be used for testing both Java and Web Applications. I plan to use SwingLibrary (with RemoteApplications) for Java apps and Java port of Selenium2Library (https://github.com/MarkusBernhardt/robotframework-selenium2library-java).
I need to download JNLP file from remote system to certain directory using Firefox (as this is typical use sceanario) and I have problem with that. I have prepared my firefox profile that makes browser to always download clicked JNLP to default directory. Now I would like to use this firefox profile in Open Browser keyword from Selenium2Library Java port. It looks that this keyword is missing ff_profile_dir option:

Original Selenium2 keyword looks like this:
Open Browser url, browser=firefox, alias=None, remote_url=False, desired_capabilities=None, ff_profile_dir=None
Java port of Selenium2Library looks a little different:
Open Browser url, browserName=firefox, alias=NONE, remoteUrl=NONE, desiredCapabilities=NONE, browserOptions=NONE

I have found out that there is one option in desiredCapabilities that might help me - it is called firefox_profile. As this is not very well documented (https://code.google.com/p/selenium/wiki/DesiredCapabilities) I'm asking here for help.

I have created zip file of my profile directory, and then I have converted this to base64. So no my browser profile is a single file called profile.zip.b64.
I have tried to use this in my Robot testcase like this:
${firefox_profile} = Get File /home/tauser/profile.zip.b64
Open Browser ${startpage} firefox None None firefox_profile:${firefox_profile}

Unfortunately it doesn't work - I have recived error: java.lang.IllegalArgumentException: argument type mismatch

Does anybody know how could I overcome this problem? How can I take into use my selected firefox profile in Java port of Selenium2Library?

Krzysztof

Markus Bernhardt

unread,
Jul 29, 2014, 6:28:18 AM7/29/14
to krzysiek....@gmail.com, robotframe...@googlegroups.com
Hi Krzysztof,

yes, that is a difference between the Java and Python version. Reasons:

* It does only work with FireFox
* I didn't get it stable working with different FireFox versions
* It does not work with SauceLabs

Therefore I replaced ff_profile_dir with browserOptions in JSON format. It works with FireFox, Chrome and Safari. Under "preferences" you can set profile options and under "extensions" you can add local plugins to upload to the browser.

Have a look at the example here:

Cheers,
Markus


--
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.

Krzysztof Sokołowski

unread,
Jul 29, 2014, 7:43:43 AM7/29/14
to robotframe...@googlegroups.com, krzysiek....@gmail.com
Hi Markus.

Thank you for quick answer.

So there is no option at all for importing whole firefox_profile into your's Java version of Selenium2Library?

I think I could use this browserOptions but I cannot find applications section in about:config. I have found only option to set default download folder - browser.download.dir;C:\mypath.
How could I pass via JSON configuration default actions (Save File) when launching/downloading JNLP? I have tried to find this configuration option also in Mozilla documenation (http://kb.mozillazine.org/Category:Preferences
Is it really possible to set this using browserOptions? 

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

Markus Bernhardt

unread,
Jul 29, 2014, 10:24:53 AM7/29/14
to krzysiek....@gmail.com, robotframe...@googlegroups.com


Von meinem iPhone gesendet

Am 29.07.2014 um 16:23 schrieb Markus Bernhardt <markus.b...@mac.com>:

Please use:
browser.download.folderList
browser.download.dir
browser.helperApps.neverAsk.saveToDisk 


Von meinem iPhone gesendet

Am 29.07.2014 um 13:43 schrieb Krzysztof Sokołowski <krzysiek....@gmail.com>:

browser.download.dir;

Sachin Nikam

unread,
Sep 3, 2014, 9:57:42 AM9/3/14
to robotframe...@googlegroups.com
Hi Markus,

I need help with this.. 

How I can set following in the desiredcapabilites:

browser.download.folderList
browser.download.dir
browser.helperApps.neverAsk.saveToDisk 
Reply all
Reply to author
Forward
0 new messages