I'm using Selenium Webdriver (Java) and PhantomJS to test a complex JS driven website. My problem is, that the PhantomJS browser keeps the session between two tests which leads to errors in the test setup.
If I run the tests with Firefox everything works fine because Firefox uses a clean session for every test case.
My first attempt to solve the problem was to just clear the local storage by JS injection. Cookies are deleted by the Selenium exposed API driver.manage().deleteAllCookies();
But executing JavaScript without visiting a page is not allowed. So starting the browser at "about:blank" leads to an error.
So, how do I configure my phantomjs webdriver to clear the session?
I'm using phantomjs and webdriver because the selenium-grid services turned out to be not stable enough. So I start my phantomjs instance like that:
phantomjs --webdriver=1234
The fact that PhantomJS keeps sessions between tests is a known problem in GhostDriver, the Selenium Webdriver implementation in PhantomJS.
I suppose that this problem will be fixed with the PhantomJS 2 release. The bug is already fixed in GhostDriver 1.1.1, but there is no PhantomJS version which includes this GhostDriver version.
I know that Selenium Grid has a "cleanSession" option if you use GhostDriver. Also, I am pretty sure the regular WebDriver class has a option for this on a local WebDriver instance:
driver.manage().deleteAllCookies();
The version 2.0 of PhantomJS fix this issue. If you have a Linux Enviroment, you need clone the sources and compile, like this:
git clone git://github.com/ariya/phantomjs.git
cd phantomjs
git checkout 2.0
./build.sh
More info here
Related
I read along the Release Notes of each JXBrowser's Versions at the moment. But still not found any official page stating the matched (working) version that works to the Selenium library except only ONE.
CMIIW, but the page (link) only said:
This approach was tested with Selenium WebDriver 2.46 and ChromeDriver 2.16.
And what about the JXBrowser version itself... which JXBrowser version is matched to Selenium, etc....
What about JXBrowser 6.22 is it fine with Selenium 2.46 or something? Where is the page matching (working) release notes for this case actually? (sorry i'm a bit confused).
All JxBrowser versions are compatible with Selenium WebDriver. The approach described in this article is the only way JxBrowser works with Selenium.
As for the "This approach was tested with Selenium WebDriver 2.46 and ChromeDriver 2.16."
These are actual versions of Selenium WebDriver and ChromeDriver used for testing with JxBrowser. JxBrowser was not tested with the older/newer versions of Selenium WebDriver and ChromeDriver, so the smooth work with other versions is not guaranteed, though it may work without any issues.
Getting following error in selenium tests
POST /session/ee1b9201-dadc-7446-b753-0a418a230d30/moveto did not match a known command
What i've done is
Actions resetView = new Actions(driver);
resetView.moveToElement(el).perform();
Environment:
Firefox v47.0
Webdriver 3.0.0-beta2
This is entirely expected. No releases of GeckoDriver (Marionette) support the Actions class. It is one of the top priorities of Mozilla's team developing Marionette.
There is an issue that Selenium tracks, that is blocked by the Marionette issue.
Since the issue it's over 3 weeks old, and looking at their commit log, I wouldn't hold my breath for a patch anytime soon.
If you can use Firefox 47.0.1, because in Firefox 47.0 they had another bug, you can use the old WebDriver API that works (not Marionette). From 48 it stopped working, because you're supposed to use Marionette. Yes, that Marionette that is not finished.
If you must test on Firefox, I recommend you should stick to Firefox 47.0.1, Selenium 2.latest, eventually throw them in a docker image, and run like that.
That's what I do at least for Germanium, until it will hopefully eventually work also for Marionette.
I have seen this question asked in different ways but none of the answers provided will fix my problem.
I am trying to automate a Firefox plugin installation.
1) I have used Java Selenium and AutoIT and it logs into a web application.
2) After clicking on the proper links it will install the plugin.
3) Once the plugin is installed I noticed that it is installed into an anonymous profile instead of "MyProfile" the one I manually created and had my code initiating it using webdriver (see code snippet below on what was used.)
4) This poses a problem because I have more other Java Selenium AutoIT tests that rely on using "MyProfile" with the plugin installed in that profile and not "Anonymousxxxxx.profile".
5) I cannot have it install into a new anonymous profile each time the test is run. I need it to install into 1 profile each time.
Has anyone came up with a solution to this problem?
This would seem to be a common web application type of test, surely someone was able to overcome this problem.
Here is the code I have already used in hopes of having webdriver use the proper profile. Unfortunately, it appears that it just grabs all the plugins and extensions from that profile and loads it into its own "anonymous" profile.
ProfilesIni allProfiles = new ProfilesIni();
FirefoxProfile profile = allProfiles.getProfile("MyProfile");
driver = new FirefoxDriver(profile);
I'm using Selenium WebDriver with Java. I want to use Safari browser. Does Selenium WebDriver support Safari?
Experimental support of Safari was added in Selenium recently. See https://code.google.com/p/selenium/wiki/SafariDriver
The SafariDriver is still experimental and relies on a browser plugin using WebSockets to communicate to the browser. It's a great step and it's something that many have been waiting for.
However, if you want something a bit more stable, Darrel Grainger has a good post on how to instantiate a Webdriver object utilizing the Selenium RC (a.k.a Selenium 1) API.
It's probably the best way to get Safari testing going right now.
Refer latest post here by Apple:
https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari
Yes, webdriver will support Safari. following instruction https://code.google.com/p/selenium/wiki/SafariDriver
As of Safari 10, there is now a native support for WebDriver API. More info here https://webkit.org/blog/6900/webdriver-support-in-safari-10/
You can see the Selenium Java API doc:
http://selenium.googlecode.com/svn/trunk/docs/api/java/index.html
There are detail of Class SafariDriver
All these answers were out of date for me. I had to track down and find the latest ... it's located here :
http://elementalselenium.com/tips/69-safari
Download for the driver is
http://docs.seleniumhq.org/download/
Short and precise answer is YES.
Selenium 3 supports Safari 12 in a well mannered way. It's pretty much stable for automation testing.
I am using Selenium v3.141.59 with Safari v12.1.2 flawlessly.
With Selenium 3, you don't need to download/install SafariDriver explicitly; instead you just need to enable the built in SafariDriver comes with MacOS.
Web driver does support safari with the help of crome driver.
please see this
http://seleniumhq.org/docs/03_webdriver.html#selenium-webdriver-s-drivers
Yes it does support Safari but, it is not much stable as of now!
Prerequisite: Install Safari on Windows
Go to http://docs.seleniumhq.org/download/
Scroll down -> Go to the section "SafariDriver" and download "SafariDriver.safariextz"
Double click on "SafariDriver.safariextz" (previously downloaded)
Safari would open with a pop up containing "Install" button -> Click Install button
Now go to Preferences of Safari and you would see WebDriver (in my case WebDriver 2.48.0) is installed (Enable WebDriver checkbox is checked))
Write the WebDriver Java code as below:
WebDriver driver = new SafariDriver();
driver.get("https://www.packtpub.com/web-development/mastering-selenium-testing-tools-video");
No. It does not support Safari 2 or 3 with the WebDriver according to the compatibility page.
I have created a set of test cases using Firefox Driver in Eclipse IDE.
But now I need these test cases to run without opening the browser window. How can I achieve that?
Presently I am using Firefox Driver Web Driver that runs in Firefox Browser.
Can some one help me with an example?
If you do not need to think about compatibility of different web browser, you could try Celerity. It could be run automated test script without any browser window.
http://celerity.rubyforge.org/
It is based on JRuby, and is very easy to learn and use.