how to start chrome --disable-impl-side-painting in selenium - java

I'm having problems with my Selenium tests. Sometimes, I get "no such session" error in my Eclipse when I run my Selenium Test in a external server Jenkins.
I've read that the solution is starting chrome with option --disable-impl-side-painting.
Do you know how could I disable that option from my java Selenium test??
Thanks so much!!!

You could try
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-impl-side-painting");
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
WebDriver driver = new ChromeDriver(capabilities);
Hope this helps

Related

How to run Webdriver headless with Chrome profiles

I have been use Chrome profiles to login a website it was success...! But want to browser not showing up so I added options.addArguments("user-data-dir="+myProfilesPath); after then it not working! Plzz tell me why headless argument not working with profiles? And How do I solve that problem?
ChromeOptions options = new ChromeOptions();
options.setHeadless(true);
WebDriver driver = new ChromeDriver(options);
driver.get("https://www.google.com/");

How to launch chromebrowser using chrome options?

Without using The System.setProperty
System.setProperty("webdriver.chrome.driver", "F:\\New folder\\chromedriver.exe");
I have tried to launch the chrome browser using chrome options with the below code:
ChromeOptions options = new ChromeOptions();
options.setAcceptInsecureCerts(true);
options.addArguments("disable-infobars");
driver = new ChromeDriver(options);
i have set my chromedriver path in my System variables.It not Working can any figure this out.
Can you please try below code as set Binary also into Options to launch chromeBrowser:
ChromeOptions options = new ChromeOptions();
options.setBinary("C:\\Users\\raheela.aslam\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe"); //Path where the Chrome.exe exist in your machine.
System.setProperty("webdriver.chrome.driver", "C:\\chrome_driver\\chromedriver.exe");
driver = new ChromeDriver(options);
There is another way to launch chrome without setting property. This downloads the latest chrome driver version and starts it. You can use WebDriverManager within using bonigarcia dependency.
bonigarcia dependency
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();

Selenium - chrome Driver fail to start in background (without a start-up window)

I am using Selenium and trying to initialize the Chrome driver to start without a start up window.
ChromeOptions options= new ChromeOptions();
options.addArguments("--no-startup-window");
//I tried this line also: options.addArguments("--silent-launch");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(Capabilities);
I am getting the following exception:
Unknown error: Chrome failed to start: exited normally
Can anybody help me?
You need to download the binary first from selenium website, download binary according to your specifications:-
http://chromedriver.storage.googleapis.com/index.html?path=2.19/
Now set below code so selenium script will know the path of your binary
System.setProperty("webdriver.chrome.driver","./src\\lib\\chromedriver.exe");
So the code should be like this:-
System.setProperty("webdriver.chrome.driver","./src\\lib\\chromedriver.exe");
ChromeOptions options= new ChromeOptions();
options.addArguments("--no-startup-window");
//I tried this line also: options.addArguments("--silent-launch");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(capabilities);
Hope it will help you :)
I think the flag you are looking for is --headless
This feature has just been implemented in chrome 57
--no-startup-window is used for hosting background apps, see this page and as mentioned in the other answers doesn't launch a window which is why the webdriver can't talk to it.
--headless does launch a window, but doesn't make it visible.
I am using Selenium and trying to initialize the Chrome driver to start without a start up window.
According to Selenium GitHub (Strange error, chromedriver with --no-startup-window), Selenium requires JavaScript and Chrome window to work:
Much like --disable-javascript, the chromedriver will not work if you use --no-startup-window.
It needs to launch a window to establish the connection with the AutomationProxy.

Need the chrome equivalent of these (Firefox) browser profile settings in Selenium Java

I have been playing around with Selenium Java WebDriver using chrome browser and have a fair amount of success so far. I have been able to start chrome window and send and receive data just fine. I now need to figure out the chrome equivalent of the following profile settings for Firefox browser.
FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("browser.download.folderList", 2);
profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "image/jpg");
profile.setPreference("browser.download.dir", "path/to/downloads/pics/folder");
Planning on doing something like this (ref: https://sites.google.com/a/chromium.org/chromedriver/capabilities) but need set the other properties as above.
ChromeOptions chromeOptions = new ChromeOptions();
//set the rest of the preferences for chrome as shown above for Firefox
Selenium: 2.47.1
Mac: OsX Yosemite
ChromeDriver: 2.18
JDK: 1.8x
Thanks.
Try this:
ChromeOptions options = new ChromeOptions();
options.addArguments("--browser.download.folderList=2");
options.addArguments("--browser.helperApps.neverAsk.saveToDisk=image/jpg");
options.addArguments("--browser.download.dir=path/to/downloads/pics/folder");
driver = new ChromeDriver(options);

Selenium+Chrome on Ubuntu says unsupported command-line flag --ignore-certificate-error

I am using:
Ubuntu 14.x 64 bit
Chromedriver latest
Chrome latest
Selenium Java 2.37.1
JDK 1.7.0_60
When I run a selenium with google chrome, chrome window has a funny yellow warning on the top that says
You are using an unsupported command-line flag
--ignore-certificate-error
Anyone ever see that before? Is it a setting in the selenium driver java code?
I do not notice any negative effects.
This should remove your funny message. Just configure your driver.
System.setProperty("webdriver.chrome.driver","<<your chrome path>>");
// To remove message "You are using an unsupported command-line flag: --ignore-certificate-errors.
// Stability and security will suffer."
// Add an argument 'test-type'
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
capabilities.setCapability("chrome.binary","<<your chrome path>>");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(capabilities);
First import the package
import org.openqa.selenium.chrome.ChromeOptions;
to your test.
Add these in the script.
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
Another good option that worked for me - is to disble default flag --ignore-certificate-errors
For Java:
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches", Arrays.asList("ignorecertificate-errors"));
WebDriver chromeDriver = new ChromeDriver(options);

Categories