Native events behaves differently on different versions of firefox with selenium - java

Earlier I was using Firefox 25.0.1 and Selenium 2.42.2 to test my web-app. It consists of a menu tab, hovering over which gave sub menus and then I have to click on one of the sub menus. I was using following code:
Actions actions = new Actions(getFFWebDriver());
Action action = actions.moveToElement(getFFWebDriver().findElement(By.id("main.menu"))).build();
action.perform();
getWebDriver().findElement(By.xpath("//*[#id=\"submenu\"]/span")).click();
But when I upgraded my browser to version 28 it doesn't work like , it used to.
I also tried upgrading selenium version to 2.46, still it doesn't work like as it used to with selenium 2.42 and FF-25.
Any help would be appreciated.

Native event support for firefox webdriver tend to be for a few specific versions of the browsers for each release of selenium. I suspect your versions of selenium doesn't support native events in firefox 28.
The changelog for V2.42 doesn't say what version of firefox they support for native events but apparently V28 of firefox was supported in V2.41. You could always try downgrading to that version of selenium or try firefox 33 on selenium V2.46 which looks like the latest version of firefox that has native event support.
https://github.com/SeleniumHQ/selenium/blob/master/java/CHANGELOG
There is also the option of going for synthetic events over native events.

For me it works like this:
WebElement menu = driver.findElement(men);
Actions builder = new Actions(driver);
builder.moveToElement(menu).moveToElement(driver.findElement(submenu)).click().build().perform();
This works even i upgrade FF 25 -> 30 and also works well on Chrome.

Related

Where to check which JXBrowser & Selenium matched version?

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.

Bring the IE Browser to Front/focus

I am testing a platform with Selenium and IE 11 Using IE Driver 3.0.0.
Windows 10 Pro
Java JDK 1.8.0_25
As for my research, I tried this:
String currentWindow = driver.getWindowHandle();
driver.switchTo().window(currentWindow);
And with JavaScript, I also tried this. (See first answer)
Is there any way I can bring the IE window that selenium opens and bring it to front/focus it? Since I use a robot at one point to perform a few actions, I need the browser to be on focus automatically, otherwise my robot actions are not effective.
((JavascriptExecutor) driver).executeScript("window.focus()");

Selenium web driver moveToElement (Actions) throwing error with marionette driver?

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.

min-width on a table working on the latest of latest IE, Chrome, FF for windows but not Safari 5.1.7

This is similar to some questions that have been asked here before, such as this one: Safari and Chrome ignore min-width CSS propery. I'm using GWT to generate a layout in which I've used CSS to define a min-width on one of the panels (which turns out to be a style matched onto a table in the generated JS). It is working as expected on all of the latest IE, Chrome, FF, but not on the older Safari 5.1.7.
My question is, would it work on the latest Safari on a Mac, or at least on 6.0+? I don't have access to this atm, so I can't know quickly. I could possibly fiddle with other CSS properties to get the 'spanning' using min-width to work on 5.1.7 as well, but I wish not to directly modify the JS from GWT java code.
I check BrowserStack today, and it does work with 6.

Does Selenium WebDriver support Safari?

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.

Categories