Selenium not working with Firefox 3.x on linux - testing

I am using selenium-server , selenium rc for UI testing in my application . My dev box is Windows with FireFox 3.5 and every thing is running fine and cool. But when i try to run selenium tests on my build server which is a linux box , i get this error
Caution: '/usr/bin/firefox': file is a script file, not a real executable. The browser environment is no longer fully under RC control
basically the selenium-rc is not able to find the firefox executable on linux(actually its a .sh file here), which is present in the case of Windows .
Has anyone faced this error before. Please let me know for any pointers.
Thanks for any help
~Pratik
Thanks!
Pratik

This is occurring because Selenium wants to start the FireFox binary directly, rather than delegate to the normal launch script. Before checking for "firefox" (which is a script on many installations), it checks for "firefox-bin". You can circumvent this problem by creating a link named "firefox-bin" that points directly at your desired version of the firefox binary.
This is described under "Ubuntu fix" (though it actually applies to other Linux'es as well) in the Cucumber Wiki at:
https://github.com/cucumber/cucumber/wiki/Setting-up-Selenium/612fae3f39528be39594d145ec12a4747855e030

Hey, I have Selenium running on Karmic with no issues. I can't quite remember how I did it, but I think it was a case of grabbing a more recent version ot the selenium-rc-serve.jar.
I also remember looking at this post: http://tero.tilus.net/rutinat/2009/08/18/cucumber-running-selenium-on-debian-lenny/
Hope something there points you in the right direction!

Related

Selenium WDS executeScript()

I have a strange problem, which I'm unable to solve for sometime. I have a selenium WDS for Firefox browser. I tried to execute the code in JMeter UI, everything works fine. But when I try to execute the same in a server (using XVFB driver), I get the error:
rm="sun.org.mozilla.javascript.EvaluatorException: Can&apos;t find method org.openqa.selenium.remote.RemoteWebDriver.executeScript(string,org.openqa.selenium.remote.RemoteWebElement). (<Unknown source>#17) in <Unknown source> at line number 17"
All the required drivers are the same as the one I locally try. Yet, I get the error only when I run in the server but not locally. Please help
Most probably you have different versions of either WebDriver Sampler or dependency libraries, I don't see any other ways for the same script to work on one machine and don't work on another.
Install the same version of JMeter onto both machines (use JMeter 3.2 or later, whatever is available at JMeter Downloads Page)
Install latest version of the WebDriver Sampler plugin using JMeter Plugins Manager
Your test should now be running fine.

How to run the selenium code on linux using firefox without GUI?

I had redhat Linux server command line but there is no GUI for that and I need to run selenium code on this server with firefox. As I am new to selenium so I am not sure whether it will work or not.
For achieving this I had install Firefox on my Redhat linux machine successfully but not able to trigger that as it is showing no display found.
Is there any other way to achieve this for headless browsing, where virtually a firefox will be opened and selenium code can be executed without GUI. Is it possible to do??
You can use HtmlUnitDriver of selenium to use headless browsing but it will not open firefox and may be not loading all content to it's cache as same as firefox
Refer Below:-
https://code.google.com/p/selenium/wiki/HtmlUnitDriver
Another thing you can use is Phantomjs with selenium Webdriver. This is most using pattern by industries for headless browsing
Refer below:-
http://www.guru99.com/selenium-with-htmlunit-driver-phantomjs.html
Yes you can trigger selenium file using command line
http://www.tutorialspoint.com/testng/testng_executing_tests.htm
Bash file is running fine in windows for testng but it is not working in linux/mac
Now if still your firefox is not opening then it is basically issue of some setting with your OS with firefox
Refer that too :-
https://serverfault.com/questions/279036/open-terminal-via-ssh-run-firefox-display-not-found
May be you have problem with some permission in red hat
Hope it will help you :)

How to force compatibility view

I have IE 11 installed, but I need to run a few tests in IE 8, 9, & 10 as well. How can I force the compatibility mode when running a test.
FYI, I did try F12, and set the mode to 8. It works manually, but not through selenium.
Thanks!
I ran into exact same issue recently. Unfortunately, there is no way unless you change page source. See this. However, I can tell you what I have done. I used VMS of course. Luckily, microsoft also provides trial versions of VMS with different versions of IE. visit this. After getting the VMs ready I installed NUNit Console. I then simply copied and loaded the test dll on that and just run.

Selenium scripts fail after newest Windows update

I have a question regarding Selenium and the current Microsoft updates:
I just installed the newest Microsoft patches on a PC and now the Selenium scripts won't work anymore. I'm using the Selenium IE Driver 2.44.0 in the scripts. Maybe something has changed in the Internet Explorer, I'm not sure. Suddenly the scripts can't find any web elements on the page anymore. An InvalidSelectorException is thrown because the findElements methods can't be executed. The IE driver opens up and it navigates to the given URL, but when it tries to find a web element, the script fails. I also tried it out on a PC which hasn't the newest updates installed yet and the scripts are working fine there, there are no problems at all.
Do you have any ideas what to do or what could be the cause?
Thanks a lot!
Yes as I stated here
If you have taken windows update KB3025390 IE will not work as expected. There is currently no resolution to that yet.
Also, Uninstalling the update KB3025390 should make the WebDriver work correctly with Internet Explorer 11. See this answer

Testing with Web Driver and Selenium through Codeception

I know I'll get crap for this but it's worth it if someone can help.
I can't find a guide, tutorial, or instructions anywhere for installing web driver on a windows machine. I've got a site running on a homestead vagrant box and need a way of running acceptance tests locally. I had tests setup using PhpBrowser but those don't simulate JavaScript. If anyone knows of a guide to do this or a better way to run acceptance tests it would help immensely. I've got Ajax calls so PhpBrowser and resources like it won't work.
Thanks!
Just download the selenium webserver the jar file and run it in a command shell with java -jar selenium-server-standalone-2.43.1.jar. The selenium server will now listen on the default port 4444. If you run your test it should work as expected. Keep in mind that selenium webserver opens firefox and uses it for testing. It's pretty useful for watching the test cases.
If you want a headless test (no visible browser) you need to download phantomjs. Unpack it and run the phantomjs.exe with --webdriver=4444 as an argument (so phantomjs.exe --webdriver=4444).
Download and Run the selenium-server-standalone-2.43.1.jar as stated in the comment. I had to add firefox_binary: C:\Program Files (x86)\Mozilla Firefox\firefox.exe under capabilities: in my acceptance.suite.yml file. I also added it to the path variable but I'm not sure if that made a difference. Had to add the firefox_binary to make it work.