How to run selenium using other browsers? - java

I've configured the Selenium 2.0 IDE in Firefox and I execute my Project using this IDE.
Execute the Project using IDE.
And i Play back the executed screens.
Saved those Test case in HTML and Java format. (For Java: I used Jnit/Webdriver)
Then i open the java file using eclipse to change for Chrome Driver
After that i append this code into that System.setProperty();
Then i executed the Chromewebdriver using Command Prompt java -Dwebdriver.chrome.driver=/path/to/chromedriver -jar selenium-server-standalone-2.7.0.jar
Then i got the error as
C:\Program Files\Java\jdk1.6.0\bin>java -Dwebdriver.chrome.driver=c:/Users/FSP/D
ownloads/chromedriver.exe -jar selenium-server-standalone-2.39.0.jar
Unable to access jarfile selenium-server-standalone-2.39.0.jar
C:\Program Files\Java\jdk1.6.0\bin>java -Dwebdriver.chrome.driver=c:/Users/FSP/D
ownloads/chromedriver.exe -jar c:/Users/FSP/Downloads/selenium-server-standalone
-2.39.0.jar
Feb 22, 2014 6:48:37 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
18:48:39.395 INFO - Java: Sun Microsystems Inc. 1.6.0-b105
18:48:39.405 INFO - OS: Windows Vista 6.1 x86
18:48:39.618 INFO - v2.39.0, with Core v2.39.0. Built from revision ff23eac
18:48:40.440 INFO - Default driver org.openqa.selenium.iphone.IPhoneDriver regis
tration is skipped: registration capabilities Capabilities [{platform=MAC, brows
erName=iPhone, version=}] does not match with current platform: VISTA
18:48:40.500 INFO - Default driver org.openqa.selenium.iphone.IPhoneDriver regis
tration is skipped: registration capabilities Capabilities [{platform=MAC, brows
erName=iPad, version=}] does not match with current platform: VISTA
18:48:41.089 INFO - RemoteWebDriver instances should connect to:
18:48:41.091 INFO - Version Jetty/5.1.x
18:48:41.122 INFO - Started HttpContext[/selenium-server/driver,/selenium-server
/driver]
18:48:41.124 INFO - Started HttpContext[/selenium-server,/selenium-server]
18:48:41.125 INFO - Started HttpContext[/,/]
18:48:41.772 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#1db4f6
f
18:48:41.772 INFO - Started HttpContext[/wd,/wd]
18:48:41.799 WARN - Failed to start: SocketListener0#0.0.0.0:4444
Exception in thread "main" org.openqa.jetty.util.MultiException[java.net.SocketE
xception: Unrecognized Windows Sockets error: 0: JVM_Bind]
at org.openqa.jetty.http.HttpServer.doStart(HttpServer.java:696)
at org.openqa.jetty.util.Container.start(Container.java:72)
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:4
88)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:30
0)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:24
5)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:96)
java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.<init>(ServerSocket.java:185)
at org.openqa.jetty.util.ThreadedServe`enter code here`r.newServerSocket(ThreadedServer.j
ava:392)
at org.openqa.jetty.util.ThreadedServer.open(ThreadedServer.java:478)
at org.openqa.jetty.util.ThreadedServer.start(ThreadedServer.java:504)
at org.openqa.jetty.http.SocketListener.start(SocketListener.java:202)
at org.openqa.jetty.http.HttpServer.doStart(HttpServer.java:726)
at org.openqa.jetty.util.Container.start(Container.java:72)
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:4
88)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:30
0)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:24
5)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:96)
C:\Program Files\Java\jdk1.6.0\bin>
How to solve this? So please try to configure and run the script through other browsers using webdriver concept.

It might be classpath issue....
Download the latest version of selenium, say 2.39.0 from the seleniumHQ.org site.
Place it in C:\ drive. Goto the environment variables and add java -jar selenium-server-standalone-2.39.0.jar to the classpath

Related

soapui window disappears after few sec

I have installed SoapUI 5.5.0 in rhel 7.8 server and trying to open it via MobaXterm on windows 10 local desktop.
When i run soapui.sh, soapui window opens up and display below messages on server,
#./soapui.sh
================================
=
= SOAPUI_HOME = /opt/SoapUI-5.5.0
=
================================
Configuring log4j from [/opt/SoapUI-5.5.0/bin/soapui-log4j.xml]
16:52:38,534 INFO [DefaultSoapUICore] Creating new settings at [/root/soapui-settings.xml]
16:52:39,328 INFO [PluginManager] 0 plugins loaded in 2 ms
16:52:39,328 INFO [DefaultSoapUICore] All plugins loaded
Configuring log4j from [/opt/SoapUI-5.5.0/bin/soapui-log4j.xml]
16:52:39,556 INFO [DefaultSoapUICore] Creating new settings at [/root/soapui-settings.xml]
16:52:39,601 INFO [PluginManager] 0 plugins loaded in 11 ms
16:52:39,601 INFO [DefaultSoapUICore] All plugins loaded
16:52:39,844 INFO [SoapUI] Used java version: 1.8.0_221
It opens another window called as 'Stay Tuned!'. As soon as i click on 'Yes, I want to know' or 'skip' button it gives below error on linux server and soapui window disappears.
Exception in thread "Thread-12" sun.reflect.generics.reflectiveObjects.NotImplementedException
at com.smartbear.analytics.impl.SoapUIOSMixpanelProvider.trackError(SoapUIOSMixpanelProvider.java:53)
at com.smartbear.analytics.AnalyticsManager$1.run(AnalyticsManager.java:55)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
Prism-ES2 Error : GL_VERSION (major.minor) = 1.4
java.lang.UnsupportedOperationException: Internal Error
at com.sun.glass.ui.gtk.GtkApplication.lambda$new$5(GtkApplication.java:158)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.glass.ui.gtk.GtkApplication.<init>(GtkApplication.java:140)
at com.sun.glass.ui.gtk.GtkPlatformFactory.createApplication(GtkPlatformFactory.java:41)
at com.sun.glass.ui.Application.run(Application.java:146)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:278)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
at javafx.embed.swing.JFXPanel.lambda$initFx$2(JFXPanel.java:232)
at java.lang.Thread.run(Thread.java:748)
Its a vm on vmware platform and have driver as below.
00:0f.0 VGA compatible controller: VMware SVGA II Adapter (prog-if 00 [VGA controller])
Subsystem: VMware SVGA II Adapter
Flags: bus master, medium devsel, latency 64, IRQ 16
I/O ports at 1070 [size=16]
Memory at e8000000 (32-bit, prefetchable) [size=128M]
Memory at fe000000 (32-bit, non-prefetchable) [size=8M]
[virtual] Expansion ROM at c0400000 [disabled] [size=32K]
Capabilities: [40] Vendor Specific Information: Len=00 <?>
Capabilities: [44] PCI Advanced Features
Kernel driver in use: vmwgfx
Kernel modules: vmwgfx
I have below libgl related packages installed on server.
# rpm -qa |grep -i libGL
libglvnd-1.0.1-0.8.git5baa1e5.el7.x86_64
libglvnd-opengl-1.0.1-0.8.git5baa1e5.el7.x86_64
mesa-libGL-18.3.4-10.el7.x86_64
mesa-libglapi-18.3.4-10.el7.x86_64
libglvnd-glx-1.0.1-0.8.git5baa1e5.el7.x86_64
libglvnd-egl-1.0.1-0.8.git5baa1e5.el7.x86_64
libglvnd-gles-1.0.1-0.8.git5baa1e5.el7.x86_64
libglvnd-core-devel-1.0.1-0.8.git5baa1e5.el7.x86_64
mesa-libGLU-devel-9.0.0-4.el7.x86_64
libglvnd-devel-1.0.1-0.8.git5baa1e5.el7.x86_64
mesa-libGL-devel-18.3.4-10.el7.x86_64
mesa-libGLU-9.0.0-4.el7.x86_64
Can you please let me know how to fix this issue?
Thanks,
The below line in /opt/SoapUI-5.5.0/bin/soapui.sh was uncommented to disable the browser component. After his, the SoapUI was no longer crashing as before.
#uncomment to disable browser component
JAVA_OPTS="$JAVA_OPTS -Dsoapui.browser.disabled=true"

Selenium error to launch firefox24

I have this problem with selenium. I can't launch a test because this problem :
PHPUnit_Framework_Error :
Response from Selenium RC server for getNewBrowserSession(*firefox C:\Firefox24\firefox.exe, /).
Failed to start new browser session: org.openqa.selenium.server.RemoteCommandException: Error while launching browser.
Version :
λ java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)
selenium : selenium-server-standalone-2.47.1
I need help, thank you :)
Full error :
java -jar "C:\selenium\selenium-server-standalone-2.47.1.jar" -singleWindow -browserSessionReuse
15:02:46.717 INFO - Launching a standalone Selenium Server
15:02:47.363 INFO - Java: Oracle Corporation 25.51-b03
15:02:47.364 INFO - OS: Windows 7 6.1 amd64
15:02:47.372 INFO - v2.47.1, with Core v2.47.1. Built from revision 411b314
15:02:47.372 INFO - Will recycle browser sessions when possible.
15:02:47.428 INFO - Driver class not found: com.opera.core.systems.OperaDriver
15:02:47.428 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
15:02:47.610 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
15:02:47.611 INFO - Selenium Server is up and running
15:03:00.087 INFO - Command request: getNewBrowserSession[*firefox C:\Firefox24\firefox.exe, /] on session null
15:03:00.089 INFO - grabbing available session...
15:03:00.090 INFO - creating new remote session
15:03:00.147 INFO - Allocated session 8d5c66b5a2d841819be7fcb7202bc4d8 for /, launching...
15:03:00.149 ERROR - Failed to start new browser session, shutdown browser and clear all session data
java.lang.RuntimeException: java.net.MalformedURLException: no protocol: /
at org.openqa.selenium.net.Urls.toProtocolHostAndPort(Urls.java:47)
at org.openqa.selenium.server.browserlaunchers.LauncherUtils.getDefaultRemoteSessionUrl(LauncherUtils.java:133)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.launchRemoteSession(FirefoxChromeLauncher.java:320)
at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.launchRemoteSession(FirefoxLauncher.java:102)
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:400)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:144)
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:105)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:818)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:435)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:405)
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:151)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
Caused by: java.net.MalformedURLException: no protocol: /
at java.net.URL.<init>(URL.java:586)
at java.net.URL.<init>(URL.java:483)
at java.net.URL.<init>(URL.java:432)
at org.openqa.selenium.net.Urls.toProtocolHostAndPort(Urls.java:37)
... 19 more
I've had this problem with newer versions of Firefox. Use Firefox 34.0.5 and it should work fine.

Selenium RC: I am unable run test suite in firefox or any other browser

I am newbie with Selenium. I recently encountered with one failure that I could not overcome.
I am trying to run next suite in firefox or chrome:
C:\auto_tools>java -jar selenium-server-standalone-2.46.0.jar -htmlSuite "*googlechrome C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "http://google.com" "D:\Selenium_2.0\Selenium_tests\Selenium_IDE&Selenium Builder\Selenium_start\test_suit.html" "D:\Selenium_2.0\Selenium_tests\Selenium_IDE&Selenium Builder\Selenium_start\results.html"
As answer I am see chrome browser with:
http://google.com/selenium-server/core/TestRunner.html?auto=true&multiWindow=true&defaultLogLevel=info&baseUrl=http%3A%2F%2Fgoogle.com&resultsUrl=../postResults&test=http%3A%2F%2Fgoogle.com%2Fselenium-server%2Ftests%2Ftest_suit.html
and
23:02:46.698 INFO - Launching a standalone Selenium Server
23:02:46.825 INFO - Java: Oracle Corporation 25.45-b02 23:02:46.826
INFO - OS: Windows 7 6.1 amd64 23:02:46.838 INFO - v2.46.0, with Core
v2.46.0. Built from revision 87c69e2 23:02:46.897 INFO - Driver class
not found:com.opera.core.systems.OperaDriver 23:02:46.897 INFO -
Driver provider com.opera.core.systems.OperaDriver is not registered
23:02:47.096 INFO - Launching Google Chrome...
with *firefox path/to/firefox.exe - same issue...
Can anyone help please?
Yesterday I found out that the reason was that my antivirus blocked connection to localhost including port 4444 - thats why I could not run test suit.

Selenium RC doesn't run the test suite by BAT file

I've tried to run my test suite by Selenium RC through a BAT file.
Actually it worked OK until yesterday morning and it stopped to run my test suite.
Probably because I've added user-extensions.js and since that I can't run my test suite by the selenium RC.
How can I add this script to my test suite?
I'm using Selenium IDE for to write my test cases, so I guess that make this more complex problem..
This is the console log of the BAT file during the execution:
>
C:\automation>cd C:\automation\screenshots\
C:\automation\screenshots>del *.png
Could Not Find C:\automation\screenshots\*.png
10:46:38.926 INFO - Launching a standalone server
10:46:39.098 INFO - Java: Oracle Corporation 25.25-b02
10:46:39.098 INFO - OS: Windows 8.1 6.3 amd64
10:46:39.113 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf
10:46:39.238 INFO - RemoteWebDriver instances should connect to: http://127.0.0.
1:4444/wd/hub
10:46:39.238 INFO - Version Jetty/5.1.x
10:46:39.238 INFO - Started HttpContext[/selenium-server,/selenium-server]
10:46:39.379 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler#6e3c1e
69
10:46:39.379 INFO - Started HttpContext[/wd,/wd]
10:46:39.379 INFO - Started HttpContext[/selenium-server/driver,/selenium-server
/driver]
10:46:39.379 INFO - Started HttpContext[/,/]
10:46:39.379 INFO - Started SocketListener on 0.0.0.0:4444
10:46:39.379 INFO - Started org.openqa.jetty.jetty.Server#b1bc7ed
jar:file:/C:/automation/selenium-server-standalone-2.44.0.jar!/customProfileDirC
USTFFCHROME
10:46:39.535 INFO - Preparing Firefox profile...
10:46:42.666 INFO - Launching Firefox...
10:46:44.245 INFO - Checking Resource aliases
This is the code line from the BAT file:
java -jar C:\automation\selenium-server-standalone-2.44.0.jar -htmlSuite "*firefox C:\Program Files (x86)\Mozilla Firefox\firefox.exe" "https://www.mywebsite.com" "C:\automation\emailSanity.html" "C:\automation\testing_results.html" -port 4444
This is the screenshot of the actual result of the Selenium RC in action:
http://i57.tinypic.com/28u71jl.png
Please your help!
Thanks a lot.
Considering your app is at the splash screen, I can only assume that you forgot to put in your URL to initially open.
Since you are using RC, then your first statement of your test script should be:
selenium.open("http://example.com"); // where example.com is the app is your SUT.

Selenium Server doesn't bind to socket after being killed with SIGTERM

After being killed once, selenium server hangs on all further startups without even trying to acquire the server port.
Rebooting fixes the problem. Running as a different user makes selenium start up again as well, but after that process gets killed it won't work no more.
This is on Linux 2.6.32-5-amd64 (debian squeeze) in a VirtualBox VM. Looking at a log of the system calls when it's working and when it's not, some component seems to lock up before the socket is even bound. The selenium log isn't of much help.
The output doesn't give any indication either:
$ java -jar selenium-server-standalone-2.28.0.jar
Dec 27, 2012 5:41:35 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
17:41:35.703 INFO - Java: Sun Microsystems Inc. 14.0-b16
17:41:35.704 INFO - OS: Linux 2.6.32-5-amd64 amd64
17:41:35.737 INFO - v2.28.0, with Core v2.28.0. Built from revision 18309
17:41:35.867 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
17:41:35.868 INFO - Version Jetty/5.1.x
17:41:35.868 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
17:41:35.869 INFO - Started HttpContext[/selenium-server,/selenium-server]
17:41:35.869 INFO - Started HttpContext[/,/]
This is a Java problem; its RNG needlessly reads from /dev/random. On a VM, the random pool is limited and often exhausted after one or two runs. For some reason, a part of the selenium/Jetty startup asks for the problematic RNG. To fix the problem, advise Java to use /dev/urandom instead:
java -Djava.security.egd=file:/dev/./urandom \
-jar selenium-server-standalone-2.28.0.jar
works fine.

Categories

Resources