by admin | Aug 10, 2019 | Selenium Testing, Fixed, Blog |
We know that there are multiple Selenium Client bindings available to automate web applicationsusing different programming languages and the client binding list is already available in SeleniumHQ website. In this blog article, we have listed the third party Selenium client bindings which are not known to many.
CrystalSelenium Webdriver bindings for the Crystal programming language.
GoThe most complete, best-tested WebDriver client for Go
C++A C++ client library for Selenium Webdriver. BEWARE! This code has never been in production, uses very old dialect of C++ and is not maintained. It could be, theoretically, used as a starting point for a new development, but definitely not as a production-ready library.
RustA Rust Client for the Selenium webdriver (WIP)
JuliaThis is a wrapper around Selenium WebDriver’s python bindings. It can be used to write web-browser interaction tests in Julia.
Common LispAsh is a Selenium client for Common Lisp. It was written against the Selenium 2.x JSON wire protocol.
by admin | Apr 28, 2019 | Selenium Testing, Fixed, Blog |
In Selenium 4.0, you can open new window & tab using “newWindow” command. Please note: Selenium 4.0 is yet to be released. However, you can try this feature using Firefox 66 & Selenium 4.0.0-alpha-1 versions.
Selenium 4.0 (Alpha) Maven Dependency
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.0.0-alpha-1</version>
</dependency>
Code
System.setProperty("webdriver.gecko.driver", "drivers/geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.switchTo().newWindow(WindowType.WINDOW);
driver.switchTo().newWindow(WindowType.TAB);
Follow our blog to receive Selenium related updates.
by admin | Apr 30, 2019 | Selenium Testing, Fixed, Blog |
Sometimes, logs from Chrome are useful to understand application’s issues. However, when the Selenium is being executed, we can’t capture and verify Chrome logs.
In Selenium 4, you can listen Chrome Console logs using “Devtools” interface. In this blog, you will learn how to listen Chrome console logs using Selenium 4.0 (Alpha).
Selenium 4.0 (Alpha) Maven Dependency
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.0.0-alpha-1</version>
</dependency>
Sample Code
DevTools devTools = ((ChromeDriver)driver).getDevTools();
devTools.createSession();
devTools.send(Log.enable());
devTools.addListener(Log.entryAdded(), entry -> System.out.println(entry.asSeleniumLogEntry()));
Using the above code, Chrome DevTools Console logs can be published in Log4j or LogBack files.
Full Code
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.devtools.DevTools;
import org.openqa.selenium.devtools.Log;
import org.slf4j.*;
public class Selenium4Devtools {
final static Logger logger = LoggerFactory.getLogger(Selenium4Devtools.class);
public static void main(String args[]){
System.setProperty("webdriver.chrome.driver", "drivers/chromedriver.exe");
WebDriver driver = new ChromeDriver();
try{
DevTools devTools = ((ChromeDriver)driver).getDevTools();
devTools.createSession();
devTools.send(Log.enable());
devTools.addListener(Log.entryAdded(), entry -> logger.error(entry.asSeleniumLogEntry().getMessage()));
driver.get("http://www.codoid.com");
}
catch(Exception e){
e.printStackTrace();
}
finally {
driver.quit();
}
}
}
by admin | Feb 23, 2019 | Selenium Testing, Fixed, Blog |
The experts who are using Selenium WebDriver from the beginning, they are aware of how IE Driver was evolved and what are all the desired capabilities were introduced. However, many don’t know the IE driver settings and options which are required and why do we need them while instantiating WebDriver. As a leading software testing company, creating robust automated test scripts is one of the core values. Today, we will share important IE driver configurations which every automation tester should be familiar with.
By default, the IE driver uses native events i.e. Using Windows OS Level messaging to simulate user keyboard and mouse inputs. If you want all your Selenium actions to be performed through JavaScript or you are facing slowness in entering values in textboxes, then disable native events as shown below.
InternetExplorerOptions options = new InternetExplorerOptions();
options.disableNativeEvents();
WebDriver driver = new InternetExplorerDriver(options);
IE driver window receives WM_MOUSEMOVE message to perform native mouseover event. However, we have a problem with this. The hover native event will be very quick and it won’t persist. Hovering should happen as same as how an user does. If you enable Persistent Hovering, the WM_MOUSEMOVE message will be sent to the IE window multiple times to hover on a webelement in a separate thread.
InternetExplorerOptions options = new InternetExplorerOptions();
options.enablePersistentHovering();
Never use this setting unless if your windows machine does not have the registry access to check the protected mode settings via WebDriver code. Whenever IE driver is instantiated, it will check Protected Mode settings in Windows Registry. If you want to ignore this checking, you can use this setting to ignore Protected Mode settings verification.
Note: Don’t use “introduceFlakinessByIgnoringSecurityDomains” setting even though the protected mode settings are configured correctly and you have necessary access for the registry settings.
InternetExplorerOptions options = new InternetExplorerOptions();
options.introduceFlakinessByIgnoringSecurityDomains();
Whenever IE driver is launched, WebDriver will check whether the IE Zoom Level Setting is set to (100%). Setting 100% will ensure the automated testing execution robust and your Selenium WebDriver commands won’t fail due to page formatting and WebElement sizing issues. If you want to ignore this detection while launching the IE driver, you can use “ignoreZoomSettings”.
InternetExplorerOptions options = new InternetExplorerOptions();
options.ignoreZoomSettings();
by admin | Feb 9, 2019 | Selenium Testing, Fixed, Blog |
If you want to run your Selenium script in different network conditions, you can do it using Chrome CommandExecutor.
Using Chrome Developer Tools, you can emulate different network conditions to check your app’s performance. If you want this to be implemented in automation testing, we have a command to do that. Let’s see with an example.
System.setProperty("webdriver.chrome.driver","drivers/chromedriver.exe");
ChromeDriver driver = new ChromeDriver();
CommandExecutor executor = driver.getCommandExecutor();
//Set the conditions
Map<String, Object> map = new HashMap<String, Object>();
map.put("offline", false);
map.put("latency", 5);
map.put("download_throughput", 5000);
map.put("upload_throughput", 5000);
Response response = executor.execute(new Command(driver.getSessionId(),"setNetworkConditions", ImmutableMap.of("network_conditions", ImmutableMap.copyOf(map))));
driver.get("http://google.com");
Initially, we didn’t have this implementation in Java bindings to set network conditions. After a fix from Andrii Rohovets, GET_NETWORK_CONDITIONS, SET_NETWORK_CONDITIONS and DELETE_NETWORK_CONDITIONS are available to emulate network conditions in Selenium & Java.
by admin | Jan 31, 2019 | Selenium Testing, Blog |