20

You're actually creating a second Selenium session in your tearDown() function. You need to put the session created in setUp() into an instance variable, then close that session in tearDown(). class TestFoo(unittest.TestCase): def setUp(self): self.selenium = selenium('localhost', 4444, "*chrome", 'http://blackpearl/') self.selenium....


19

driver.close() and driver.quit() are two different methods for closing the browser session in Selenium WebDriver. driver.close() - It closes the the browser window on which the focus is set. driver.quit() – It basically calls driver.dispose method which in turn closes all the browser windows and ends the WebDriver session gracefully. You should use ...


17

Just in case someone sees that post , I added : cOptions.setExperimentalOption("excludeSwitches", Arrays.asList("enable-automation")); And it caused the driver to crash when calling: driver().manage().window().maximize(); So I had to remove it. Anyway , Adding : options.addArguments("disable-infobars"); solved the original issue. Thank you all for ...


12

See the answer to "ChromeDriver user preferences ignored" cOpt.AddUserProfilePreference("credentials_enable_service", false); cOpt.AddUserProfilePreference("profile.password_manager_enabled", false);


9

I have worked with Web Driver in both java and C# and I use In Java : WebDriver driver; driver.quit(); In C# : IWebDriver Driver; Driver.Quit();


8

Not Working I've tried the --lang=us option, as suggested, but also had no success using the code below. My webpages were still being downloaded with my default language (that's not en). from selenium import webdriver options = webdriver.ChromeOptions() options.add_argument('lang=en') # options.add_argument('--lang=en') <- Tried this option as well ...


7

In Java: ChromeOptions options = new ChromeOptions(); options.addArguments("--start-maximized"); options.addArguments("--disable-web-security"); options.addArguments("--no-proxy-server"); Map<String, Object> prefs = new HashMap<String, Object>(); prefs.put("credentials_enable_service", false); prefs.put("profile.password_manager_enabled", false)...


7

There is not any way to automate captcha submission. Actually, that's the reason captcha is used for. All you can do are: ReCAPTCHA's documentation provides a set of keys that you can use for testing. You can also whitelist your testing domains for exclusion. Run your tests on a development or staging environment and disable the CAPTCHA in that environment. ...


6

Sadly none of the answers above are explaining what the real question here is. To understand how the chromedriver works fundamentally, you need to understand the root first. What is WebDriver anyway? Selenium WebDriver or WebDriver, as it is called, is actually an open source tool for automating testing of web-apps across many browsers. It does that by ...


6

Here is the completed example that demonstrates how you can modify requests from your Selenium tests. To demonstrate one I have created a sample REST mock service via SoapUI that would return just a {"SUCCESS"} message for any response. The test code (TestNg is used for test running, and borwsermob-proxy for proxying requests): public class MiscTests { ...


5

It looks like you simply need to encode the file to a base64 string: chromeOptions : { extensions: [encode('./extension_1_5.crx')] } function encode(file) { var stream = require('fs').readFileSync(file); return new Buffer(stream).toString('base64'); }


5

Solution for Python 3: from selenium import webdriver from selenium.webdriver.chrome.options import Options chrome_options = Options() chrome_options.add_argument("--disable-infobars") browser = webdriver.Chrome(executable_path = path_to_chromedriver,chrome_options=chrome_options)


5

I think you just need to re-raise the assertion error after printing out log messages: try: self.assertEqual(len(self.verificationErrors), 0) # no errors except AssertionError as e: for message in self.verificationErrors: print(str(message)) raise # < HERE Also, if you want to check for severe console messages after every single ...


4

You should not be running tests on a machine used by user(s). Set up a dedicated computer or VM for testing and and use headless browser mode (more info here and here).


3

You can use ChromeOptions options = new ChromeOptions(); options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation")); Also, it's better to use Collections.singletonList instead of Arrays.asList since we are passing in a single argument to excludeSwitches. Disabling the infobar using --disable-infobars flag will ...


3

In Python, using selenium webdriver for Chrome, I needed to call stop_client() before close(): from selenium import webdriver in setUp(): options = webdriver.chrome.options.Options() options.add_argument("--disable-extensions") # optional and off-topic, but it conveniently prevents the popup 'Disable developer mode extensions' self.driver = webdriver....


3

What Flavio Barisi said, with the addition of the capabilities you pass to your driver. ChromeOptions options = new ChromeOptions(); options.addArguments("--start-maximized"); Map<String, Object> prefs = new HashMap<String, Object>(); prefs.put("credentials_enable_service", false); prefs.put("profile.password_manager_enabled", false); options....


3

I have seen the same thing, our box that runs our automation has been running out of space. We found out that Chrome was the culprit. I don't have the answer to solve the root problem, but I have created a batch script that I have scheduled to run daily on windows machine that cleans up all the temporary folders. To create a batch file just open notepad, ...


3

Disable-infobars flag has been removed per this merged commit below. for more details check here: 1. chromium.googlesource.com 2. chromium-review.googlesource.com This flag is no longer needed by the perf testing infrastructure and can be misused for malicious purposes, so remove it. Update April 18, 2018: --disable-infobars has been added back to ...


3

In your code you should instantiate two drivers. One instance for Chrome and the second one for IE. Now you can operate with both the browsers. Below is the example in Java: public static void main(String[] args) { // Configure both drivers System.setProperty("webdriver.chrome.driver", "Path to your chromedriver"); System.setProperty("webdriver....


3

Oh blah! https://stackoverflow.com/questions/45372066/is-it-possible-to-run-google-chrome-in-headless-mode-with-extensions/45372648#45372648 Firefox supports headless extensions but not google chrome. :(


3

use the below code driver.get(enter the url); ((JavascriptExecutor)driver).executeScript("window.open()"); ((JavascriptExecutor)driver).executeScript("window.open()"); ArrayList<String> tabs = new ArrayList<String>(driver.getWindowHandles()); driver.switchTo().window(tabs.get(1)); driver.get("http://google.com");


3

You can run ChromeDriver in silent mode. When you execute ChromeDriver, you have to set the log level in the command line arguments: chromedriver --log-level=OFF Similar post in (StackOverflow) https://stackoverflow.com/questions/18702533/how-to-execute-selenium-chrome-webdriver-in-silent-mode Edit --log-level=3 offer a minimal amount of logs, but if ...


3

Driver d1 = new Driver(profile); d1.start(); Driver d2 = new Driver(profile1); d1.start(); Here you create Driver d2 but start d1.start() the second time then (you have started it two lines of code before)


3

Why not use an API that downloads the Webdriver, sets the environment variables and removes the issue of updating the path if the project is shared on another computer/server? This would do : https://github.com/bonigarcia/webdrivermanager


3

Selenium doesn't have API to do that. You need to use something external. As Alexey suggested one of the solutions would be setting up proxy like this.


3

You cannot achieve it by Selenium, but as you mentioned you are using BrowserMobProxy , I would recommend you to try once below . Apache Module mod_headers ( Refer : http://httpd.apache.org/docs/current/mod/mod_headers.html#page-header ) You can also install Fiddler (http://www.fiddler2.com/fiddler2/) which is very easy to install (easier than Apache for ...


2

Try and convert this to the Python equivalent. Check this link: For Firefox: FirefoxProfile profile = new FirefoxProfile(); profile.setPreference( "intl.accept_languages", "es" ); WebDriver driver = new FirefoxDriver(profile); For Chrome: ChromeOptions options = new ChromeOptions(); options.AddArguments("--lang=es"); ChromeDriver driver = new ...


2

WebDriver driver; driver.quit(); Above will close all open browser windwos. And WebDriver driver; driver.close(); This will close current browser window in focus.


2

This is works for me (in python): from selenium import webdriver options = webdriver.ChromeOptions() options.add_experimental_option("excludeSwitches", ["ignore-certificate-errors"]) webdriver_instance = webdriver.Chrome(chrome_options=options) See also: https://stackoverflow.com/questions/24507078/how-to-deal-with-certificates-using-selenium and https://...


Only top voted, non community-wiki answers of a minimum length are eligible