Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
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 { ...


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

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

Yeah, it can be a general issue as browsers (especially Chrome) don't always like closing their driver processes. You can put the below in the onFinish all tests method which kills them: String systemType = System.getProperty("os.name").toLowerCase(); if (systemType.contains("win")) { try { // Selenium drivers don't ...


1

It turns out the reason chromedriver knows where chrome is installed is it looks for it in the default installation locations. See chromedriver requirements I ended up using writing this script. def chrome_version(): osname = platform.system() if osname == 'Darwin': installpath = "/Applications/Google\ Chrome.app/Contents/MacOS/Google\ ...


1

You can obtain the browser version via WebDriver like this: Capabilities cap = ((ChromeDriver) driver).getCapabilities(); System.out.println(cap.getVersion()); I have tested it on Windows using old WebDriver version (2.44) vs current Chrome (78), I am not sure how this will work with new WebDriver vs old chrome on Ubuntu.


1

To add to the answer by @Klynt, although this is a solution, this is deprecated for browsers like firefox and chrome. In this approach, you don't really have expose your credentials. You can store your credentials as environment variables or in your .bashrc and export the same in your test. There is another approach as well, but you might need to downgarde ...


1

Selenium can be flaky with auto authentication. The simple solution is you're better off just altering the URL to include it. e.g. https://username:password@url.com


1

You shouldn't make the driver static. I am not a Java expert, but I think static classes only exist once. Meaning that any reference to the static objects are the same. You are trying to maintain multiple states in a single static (global) class. Static Variables: When a variable is declared as static, then a single copy of the variable is created and ...


1

If you are looking for the version of the ChromeDriver (this is different than the version of Chrome), it's a returned capability in chrome.chromedriverversion as a string.


1

In C# (VS) you should to use: string html = this.driver.PageSource; instead of driver.getPageSource();


1

The getPageSource method, in C#, is actually a property: string html = this.driver.PageSource; See PageSource documentation for more information.


1

What you're doing actually is: Click an item (click) Moving a mouse pointer to that item (moveToElement which accepts the target element as its parameter) There are no actions defined for dragging and dropping the items whatever they are (svg or other types of elements). You should use one of the following approaches: dragAndDropBy(WebElement source, int ...


1

You can add the disable-gpu option via ChromeOptions: ChromeOptions options = new ChromeOptions(); options.addArgument("disable-gpu"); WebDriver driver = new ChromeDriver(options);


1

Have a look at the webdriver-manager you can automate the download of the latest driver version. You can run it at the beginning of your end-to-end test cycle to make sure the driver is in the right location and updated. Webdriver Manager A selenium server and browser driver manager for your end to end tests. This is the same tool as webdriver-...


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