I have created multiple scripts using Selenium IDE. I can run this script only in Firefox using the extension. I want to run these scripts on different browsers like Chrome/IE using node.js. I know I can run it via java commands, but is there any way I can run it via nodejs?
Running IDE test Suites can be trigged from the command line using the selenium jar file. You can launch any browser from that command line (not just firefox).
Webdriver supports javascript/node:
http://www.seleniumhq.org/download/
http://seleniumhq.github.io/selenium/docs/api/javascript/index.html
But to run IDE tests in other browsers look at the documentation here:
https://wiki.mozilla.org/Running_IDE_scripts_with_Selenium_RC
java
-jar selenium-server.jar
-userExtensions user-extensions.js
-htmlSuite
"*chrome"
"<base URL>"
"<Selenium test suite file>"
"<results log file>"
-timeout nnnn
Specifically look at the first paramaeter after -htmlSuite:
1st parameter is the browser to run the script in. In RC 1.0.1 *chrome
= Firefox, *iehta = Internet Explorer. (options in RC 1.0.2 are expected to be *firefox and *iexplore, respectively)
Related
I am using a shared file download service which deletes the file if the file's web page has not been visited in 30 days. I need to store my files for longer than 30 days.
I am using a Centos 7 based Linux server.
My idea was to create a cron to run a bash script with a command line for each file.
I have tried using the wget, curl and lynx commands but these do not register as the page being visited.
Any ideas on a command that I can use?
The file sharing service is gofile.io and an example file I have uploaded (on the page that is required to be visited) is https://gofile.io/?c=znRpuJ
Edit: After looking into it further there appears to be a javascript function which needs to be activated which I think isn't activated by wget/curl/lynx. Is there any way to activate this javascript from the command line?
Try this:
Make sure you have Python3.
Install geckodriver.
pip install selenium for Python3.
Run the following script:
from selenium import webdriver
driver = webdriver.Firefox()
driver.get("https://gofile.io/?c=znRpuJ"
driver.quit()
Good luck.
I'm trying to scrape a third party site using Selenium (I tried using Beautiful Soup, but their authentication system is too difficult to understand so I bailed and used Selenium instead).
I'm using a python script that uses the latest Selenium 3.12.0 drivers, and the selenium-server-standalone-3.12.0.jar. Both my Linux and macOS boxes are running jdk 1.8.0_172.
If I run the script on either Linux or macOS with the selenium server on macOS it works great. If I run the script on either Linux or macOS with the selenium server on Linux, it fails to load jQuery with the following error:
18:28:02.453 ERROR [DefaultJavaScriptErrorListener.loadScriptError] - Error loading JavaScript from [https://ww6.fltplan.com/js/jquery-1.12.3.min.js].
javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1002)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
The site I'm scraping is written very primitively (looks like something out of GeoCities) so it's very likely it's doing something absurd. Oh, and this code was working a few weeks ago and I "froze" it, but then it stopped working in Linux and I had to start tinkering with it again.
Here's my connect code:
capabilities = {
'browserName': 'htmlunit',
'version': 'firefox',
'platform': 'ANY',
'javascriptEnabled': True,
'acceptInsecureCerts': True,
}
driver = webdriver.Remote(
# "http://192.168.1.46:4444/wd/hub", webdriver.DesiredCapabilities.HTMLUNITWITHJS
# "http://localhost:4444/wd/hub", webdriver.DesiredCapabilities.HTMLUNITWITHJS
"http://localhost:4444/wd/hub", capabilities
)
driver.get("https://www.fltplan.com/")
The first commented out Remote url is to Selenium running on my macOS box, it works. The second and third are attempts to make it work on Linux, so far unsuccessful. The second one is the one that worked up until a few weeks ago.
I think I have a solution. I make a copy of the java.security file in java_home/jre/lib/security and commented out all the "disabledAlgorithms" lines in the file. I start up the selenium server with nohup java -Djava.security.properties==java.security.copy -jar selenium-server-standalone-3.12.0.jar and it seems to work now.
I'd be interested in hearing an explanation why this works. I assume it means the site they're trying to download jquery from uses encryption that jdk 1.8 disables because it's considered too weak.
So I've been reading this article about running selenium-ide recorded tests in chrome on windows(http://www.software-testing-tutorials-automation.com/2016/08/run-selenium-ide-test-in-google-chrome.html). I'm using Ubuntu though, and I use newer selenium server version. How should I modify this command for it to work on linux:
java -jar selenium-server-standalone-2.46.0.jar -Dwebdriver.chrome.driver=chromedriver.exe
I know that i have to delete ".exe" but i get an error like this:
Exception in thread "main" com.beust.jcommander.ParameterException: Unknown option: -Dwebdriver.chrome.driver=chromedriver
at com.beust.jcommander.JCommander.parseValues(JCommander.java:742)
at com.beust.jcommander.JCommander.parse(JCommander.java:282)
at com.beust.jcommander.JCommander.parse(JCommander.java:265)
at com.beust.jcommander.JCommander.<init>(JCommander.java:210)
at org.openqa.grid.selenium.GridLauncherV3$1.setConfiguration(GridLauncherV3.java:227)
at org.openqa.grid.selenium.GridLauncherV3.buildLauncher(GridLauncherV3.java:155)
at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:75)
The -Dwebdriver… parameter needs to be passed to java, not Selenium itself. So just switching the argument order should work for you:
java -Dwebdriver.chrome.driver=chromedriver.exe -jar selenium-server-standalone-2.46.0.jar
Relevant Github issues: 1, 2
I need to install and run SoapUI on linux OS (Amazon AMI linux).
This is a command line version (no GUI)
I was able to successfully download and unzip SoapUI tar using the below commands
Download SoapUI installation files
wget http://freefr.dl.sourceforge.net/project/soapui/soapui/5.0.0/SoapUI-5.0.0-linux-bin.tar.gz
Extract Contents
tar -xzf SoapUI-5.0.0-linux-bin.tar.gz -C /opt/
Install SoapUI
cd /opt/SoapUI-5.0.0/bin/
After this when i run the following command:
./soapui.sh
I get below exception
java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207)
at java.awt.Window.<init>(Window.java:535)
at java.awt.Frame.<init>(Frame.java:420)
at javax.swing.JFrame.<init>(JFrame.java:218)
at com.eviware.soapui.SoapUI.startSoapUI(SoapUI.java:842)
at com.eviware.soapui.SoapUI$SoapUIRunner.run(SoapUI.java:697)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:745)
at java.awt.EventQueue.access$300(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:706)
at java.awt.EventQueue$3.run(EventQueue.java:704)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:715)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.r...(EventDispatchThread.java:91)
Is there something missing here or any other commands needs to be called ?
SoapUI itself is a graphical tool, and the main application isn't going to like running without a graphics display.
When I've run the SoapUI stuff on a Linux server without X11, it's been the mock service facility that I'm after - I use it to provide substitute SOAP or REST services for automated testing etc.
The mock service runner runs well without an X11 server - you just have to tell java not to look for a graphical user interface.
So you add -Djava.awt.headless=true to the command line:
./mockservicerunner.sh -Djava.awt.headless=true
If you just to that it will give you a 'help' output, because this tool is designed to use an existing SoapUI project file to provide preconfigured responses, rather than for interactive use.
The alternative is to use X-Forwarding, so SoapUI runs on your server, but the UI is displayed on your local workstation. I've never done that (because, as I said, I'm after the standalone interaction for automated testing), but this page has some detail: http://blog.ashwani.co.in/blog/2013-01-10/soapui-mockservicerunner-on-linux-without-x-config/
(it also mentions the 'headless' option for mockservicerunner.sh.
This page has some detail about setting up a project in SoapUI first before using it for one of the automated tools (loadrunner in this case): http://www.soapui.org/load-testing/command-line-execution.html
I just installed and executed SoapUI in AWS (Red Hat) without using any graphical interface:
1.- Download SoapUI directly from soapui.org; search for the latest Linux version, copy the link address and download the software into any Linux directory using the wget command. This should have downloaded an installation script file (for example, SoapUI-x64--5.3.0.sh).
2.- Execute the previous installation script from command line and answer the installation prompts. Once you have finished go to the directory where you elected to install it and verify that you have all the folders and files (bin, lib, etc.).
3.- To run SoapUI from the command prompt, go to your SoapUI home directory and execute an instruction like this:
sh bin/testrunner.sh -s"Your Suite Name" -c"Your Test Case Name" -f/your/output/path/ /your/project/path/your-soapui-project.xml
I have installed firewatir 1.8.0, jssh 0.9 addon.
Do I need to open the firefox browser manually from the command prompt with -jssh extension every time I want to run the tests in firefox?
When I try to run the tests without manually opening the browser I am getting the following error:
C:/Ruby192/lib/ruby/gems/1.9.1/gems/firewatir-1.8.0/lib/firewatir/firefox.rb:156:in `rescue in set_defaults': Unable to connect to machine : 127.0.0.1 on port 9997. Make sure that JSSh is properly installed and Firefox is running with '-jssh' option(Watir::Exception::UnableToStartJSShException)
Also I tried running the tests by changing the path from "C:\Program Files\Mozilla Firefox\firefox.exe" to "C:\Program Files\Mozilla Firefox\firefox.exe" -jssh in the Target text box of the Mozilla Firefox Properties window.
Yes see here fore more info
You will need to open Firefox using acommand line argument to get FireWatir to recognize jssh. To do this, open your command prompt, or a terminal, and run:
firefox.exe -jssh
or
./firefox-bin -jssh
from the appropriate folder, depending on your platform.
i'd also encourage you to look at watir-webdriver as an alternative. Ongoing development of JSSH/firewatir is doubtful for Firefox 4 and beyond. Watir-webdriver is looking like the way to go, especially if you're just starting out.
When running on my Mac the WATIR test starts Firefox with the JSSH automatically, but usually this takes longer to start than the connection timeout in the script.
So it is easier to start it manually before running the scripts.