Not able to run webdriver scripts from jmeter - testing

I am trying to execute webdriver script from jmeter.
I have installed webdriver plugin.
Created firefox config element and web driver sampler.
Added script under webdriver sampler -
WDS.sampleResult.sampleStart()
WDS.browser.get('http://google.com')
WDS.sampleResult.sampleEnd()
But while executing, browser is not opening.

I'm pretty much sure that you have Firefox version which is not supported by underlying Selenium libraries.
WebDriver Sampler plugin 1.2.1 supports Firefox 33
WebDriver Sampler plugin 1.2.0 supports Firefox 26
If you need the latest Firefox for any other reason you can have Firefox 26 or 33 installed somewhere else. Just add the following line to system.properties file (lives under /bin folder of your JMeter installation)
webdriver.firefox.bin=/path/to/your/firefox/directory
See The WebDriver Sampler: Your Top 10 Questions Answered guide for more WebDriver sampler tips and tricks.

Jmeter only supports some of the versions of Firefox to run Jmeter-webdriver script. Use firefox 45.0 it will work like pro.
The Installation of firefox should be in the default directory, do not custome the path of Firefox 45.0.

Related

How to use selenium3 in jmeter webdriver Sampler

I use JMeter4 + Selenium2 + Firefox 45 in webdriver sampler to test GUI. This works well, but if we want to test the new version of Firefox (for example, version 55), we need to install Selenium 3. The JMeter webdriver plugin (version 2.3) requires Selenium 2.
How can I make webdriver sampler + selenium 3 work in jmeter?
You will not able to use current WebDriver Sampler version with Selenium 3.x as it relies on some Selenium API which has incompatible changes, even if you upgrade Selenium libraries the WebDriver Sampler will not work.
However you can try the following approach:
Uninstall WebDriver Sampler and all its dependencies (or even better obtain a fresh copy of JMeter)
Download Selenium 3 client .jar(s) and put them into JMeter Classpath
Write your Selenium-related code using JSR223 Sampler or JUnit Request sampler
You can also reach out WebDriver Sampler plugin developers/maintainers and clarify when/if support of newer Selenium version will be added at JMeter Plugins Support Forum

JMeter WebDriver Sampler doesn't work with latest Firefox version

I use JMeter WebDriver Sampler (JMeter v4.0) for Chrome Driver (where I specify the path to chromedriver in jp#gc - Chrome Driver Config), and it works.
Now I want to try with latest Firefox Browser (FF Quantum v59.0), but it doesn't work. FF browser is opened but it doesn't go further, ex WDS.browser.get('http://jmeter-plugins.org') is not executed.
It seems JMeter WebDriver Sampler doesn't catch up with geckodriver and changes of FF. I google it, but I don't find any info on this regard. Does anyone know any update on this? Is there any workaround? Thanks
You should look at JMeter Firefox Driver Config plugin restrictions:
the latest Firefox version may not work with the latest WebDriver set. The table below describes the version of Firefox that is compatible with JMeterPlugins:
Current version is compatible only with version 26 of Firefox
Also firefox jmeter addon is not compatible
This add-on is not compatible with your version of Firefox.
Not compatible with Firefox Quantum
The jmeter firefox driver config is only compatible with firefox 26, 33 and the latest is 45 and 46.
You cannot use the version of firefox which is greater than 46.0
Did you add the geckodriver file path in environment variable "Path". If not try that. I am using latest firefox with Jmeter Webdriver and is working for me.
Computer Properties - Advance System Settings - Environment Variables - Path (Add File Path without File name)

selenium script in jmeter

I had write a script using selenium in Jmeter. Imported all the packages.
var pkg=JavaImporter(org.openqa.selenium) //import java selenium package
var support_ui=JavaImporter(org.openqa.selenium.support.ui.WebDriverWait)
var ui=JavaImporter(org.openqa.selenium.support.ui)
var wait=new support_ui.WebDriverWait(WDS.browser,5000)
WDS.sampleResult.sampleStart()
WDS.browser.get('https://www.google.com')
WDS.sampleResult.sampleEnd()
to simply open the page.
it doesn't show any results in Listener.
Have you added the relevant Config element, like:
Firefox Driver Config
Chrome Driver Config
Phantom JS Driver Config
or whatever browser you're trying to use?
If yes and you still experience problems - check jmeter.log file - it usually contains enough troubleshooting information. The most common errors are:
libraries conflict. Selenium requires newer HTTP libraries version than JMeter so:
open /lib folder of your JMeter installation
locate .jar files which names start with http
delete duplicate .jar files with lesser version
unsupported browser (mostly affects Firefox). If you're trying to run Selenium test on Firefox - make sure you use one of the supported versions. Latest JMeter Plugins WebDriver Set 1.3.1 comes with Selenium 2.47.0 and according to the changelog it should be:
Supports native events for Firefox version 31 (immediately previous ESR).
Native event support has been discontinued for versions of Firefox later
than 33. Synthetic events tested on Firefox versions 31 (immediately
previous ESR), 38 (immediately previous release and current ESR), and 39
(current release).
For extra information and tips on using WebDriver Sampler in JMeter check out The WebDriver Sampler: Your Top 10 Questions Answered guide

Suitable Chrome driver to use with selenium tests

I was wandering since there is many chrome drivers available on the nuGet Packages Manager, which one is fitting the best with Selenium tests, does it make any difference at all?
WebDriver ChromeDriver
WebDriverChromeDriver
Selenium.WebDriver.ChromeDriver
etc...
I'm using for my >30K lines of code (and 6 different web-sites) UI test project the
WebDriver ChromeDriver
with version 26.14.313457.1, it's a separate executable that WebDriver uses to control the Chrome browser. Again it requires Chromium/Google Chrome to be installed.

Not able to open firefox from selenium webdriver

I am getting the below error when i am running the selenium script.
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
fTime":1409733904986}}},{"name":"winreg-app-user","addons":{"{e4f94d1e-2f53-401e-8885-681602c0ddd8}":{"descriptor":"C:\\ProgramData\\McAfee Security Scan\\Extensions\\{e4f94d1e-2f53-401e-8885-681602c0ddd8}.xpi","mtime":1396607774000}}},{"name":"app-profile","addons":{"fxdriver#googlecode.com":{"descriptor":"C:\\Users\\kishna\\AppData\\Local\\Temp\\anonymous3395727590319882631webdriver-profile\\extensions\\fxdriver#googlecode.com","mtime":1409812670363,"rdfTime":1409812670181}}}]
1409812670931 addons.xpi-utils DEBUG Opening XPI database C:\Users\kishna\AppData\Local\Temp\anonymous3395727590319882631webdriver-profile\extensions.json
1409812670931 addons.xpi DEBUG New add-on fxdriver#googlecode.com installed in app-profile
You are using selenium version that doesn't support Firefox version 32.
And since currently there is no selenium java package version that claiming support for Firefox 32, you need to downgrade your browser. In your case, downgrade it to Firefox 28, which is listed as supported by selenium 2.42.2.
See also similar problem here:
selenium and web2py from killer-web-development.com doesn't work
Also see:
Where can I find a definitive Selenium WebDriver to Firefox Compatibility Matrix?
Documentation confusion: what version of Firefox does Selenium support?
Is Selenium 2.42.2 webdriver compatible with Firefox 27.0.1?
Please upgrade to 2.43.1 [http://www.seleniumhq.org/download/]. The new version works for FF32.
You can follow link below in the future for check supported versions FF vs. WebDriver.
I use it if I want to update browser or webdriver library.
LINK: http://selenium.googlecode.com/git/java/CHANGELOG