I want to run some test using selenium standalone server on Google Chrome but it runs Firefox instead when I execute this code:
java -Dwebdriver.chrome.driver="webdrive\chromedriver.exe" -jar ./selenium-server-2.42.2-withFarsi.jar -htmlSuite "*chrome" http://www.google.com C:\Users\...\TestSuit.html temp.html
after this it runs Firefox and starts running test as usual.
What can I do?
instead of *chrome use *googlechrome.
Related
Is it possible for puppeteer attach to a running Chrome that launched by selenium webdriver?
My automated tests are based on protractor/selenium/typescript, one of the test is going to download file in headless chrome, but download is not working due to an known bug(https://bugs.chromium.org/p/chromium/issues/detail?id=696481). I found a solution for headless download is that - using puppeteer send 'Page.setDownloadBehavior' command, then the file can be downloaded in headless.
For example, I have 10 tests, test1 ~ test9 are running on Chrome that launched by selenium webdriver, test 10 is download file test, I use puppeteer to download file in headless, but puppeteer launched another chrome instance. So is it possible for puppeteer attach to a running Chrome that launched by selenium webdriver?
I'm facing up a strange problem in Puppeteer with authentication.
I've written a script to take some screenshot of a website which required authentication.
In my local computer (windows), when running in command line as node.exe my_script.js; it's working fine (in headless moden which is the default mode).
I've written an upper Java program to manipulate it (dynamically set the path, the node modules path, run the process "nodex.exe my_script.js" every 30minutes, manage timeout of the process,...). It's still working directly running from Eclipse, in headless mode.
Then... I've built/packaged a JAR and running it in a cmd window: java -jar my_jar.jar... and then the script can't authentitcated on the website in headless mode (the answser page just write a message like "you need to be authenticated", which is managed by the http server).
To check what happen, I've just add an option in my nodejs script (so I do not modify my java upper program code) to run chrome in non headless mode; with option headless : false. And... it's working!
I let the option to run in non headless mode, and I create a Windows service to run my jar via a bat file, with the help of nssm... Just to test. I'm really happy to see that all is running fine without seeing any chrome GUI (maybe Windows disable GUI for service, don't know how).
Have I maybe missed something? Or is there a bug in Puppeteer or Chrome to manage authentication in headless mode?
Regards
Alex
I am having a jar file which I am calling from powershell script. Now when I run the script the jar file is called and when jar tries to open google chrome, it crashes. If I try running the jar outside the powershell script it works perfectly fine. I think this is a machine specific issue, because the script ps script runs perfectly fine on other machines. any suggestions??
Using Chrome's alternate installer. This will install Chrome for all users.
Link: Alternate Installer
This often fixes problems if you are running Selenium as a background service.
Passing '--no-sandbox' flag when creating your WebDriver session.
Special test environments sometimes cause Chrome to crash when the sandbox is enabled.
This question already has answers here:
How to run Google Chrome with Selenium RC?
(5 answers)
Closed 9 years ago.
I'm using jenkins to run selenium standalone server and html test suites in a windows xp node.
I've managed to get it running and working for iexplore and firefox, but when it comes to googlechrome it fails in starting it.
This is the command I use to run the tests in googlechrome:
java -jar C:\...\selenium-server-standalone-2.28.0.jar -htmlSuite "*googlechrome C:\Program Files\Google\Chrome\Application\chrome.exe --allow-file-access-from-files –-disable-web-security" file:///C:/WebTest/Tests/ C:/WebTest/Tests/TestSuite.html C:\jenkins\workspace\sp-webTest\resultados\resultadoGC.html
And the error I get is:
12:43:08.044 INFO - Launching Google Chrome...
HTML suite exception seen:
java.lang.NullPointerException
at org.openqa.selenium.server.browserlaunchers.GoogleChromeLauncher.createCommandArray(GoogleChromeLauncher.java:168)
at org.openqa.selenium.server.browserlaunchers.GoogleChromeLauncher.launch(GoogleChromeLauncher.java:82)
at org.openqa.selenium.server.browserlaunchers.AbstractBrowserLauncher.launchHTMLSuite(AbstractBrowserLauncher.java:47)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:145)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:196)
at org.openqa.selenium.server.SeleniumServer.runHtmlSuite(SeleniumServer.java:611)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:285)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:243)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:54)
Any help will be appreciated.
Specifying the webdriver in java helps.
System.setProperty("webdriver.chrome.driver", "c:/chromedriver.exe");
driver = new ChromeDriver();
Download link for chrome driver http://code.google.com/p/chromedriver/downloads/list
I got it working, somehow sending flags to chrome in the command causes selenium to throw null pointer exception. So what I did was add chrome to the PATH in mi xp node, use Selenium plugin to run html test suites in jenkins and specify a start url that begins with "https://" using google chrome and a start url that begins with "file:///" was a mess and couldn't get it to work like that. I also added the -trustAllSSLCertificates in "others" input box.
For me on Windows it work:
java -jar "c:\selenium-server-standalone-2.35.0.jar" -forcedBrowserMode "*googlechrome c:\Program Files\Google\Chrome\Application\chrome.exe"
Is it possible to build a custom google chrome extension to run selenium commands when it detects a specific Url/page?
Where to begin? How would you run selenium commands via a google chrome extension?
First install selenium IDE and record all your test cases into it [This is to save your time in writing test cases].
Then get selenium RC binaries for your preferred language (for me its C#). Create your project and take reference of selenium RC binaries. Import all test cases from above selenium IDE in your preferred language and add those into your project.
When you will import the test cases from IDE default browser will be *chrome(i.e. Firefox). To change it to Chrome change browser type when we are creating selenium object
selenium = new DefaultSelenium("localhost", 4444, "*googlechrome", "http://www.google.com/");
To run your project you have to first start selenium server. Here is the guideline for the same.
Note: You can also use selenium web driver in place of selenium RC. And I think if you use web driver then you no need to run selenium server to execute your test cases/project.