Instantly share code, notes, and snippets.

View file.cpp
docker run -d --link -e MY_VAR='myvar 'selenium-hub:hub -v /dev/shm:/dev/shm selenium/node-chrome:3.14.0-helium
View file.py
## NodeSelector to be used for firefoxDebug
nodeSelector:
# label: value
View file.m
for you you can add `capabilities.setCapability(ChromeOptions.CAPABILITY, options);`
but it won’t work forever
View file.sh
if(isRunningOnJenkins()) {
moveMouseToTopLeft();
}
View file.m
switch (BROWSER) {
default:
case CHROME:
ChromeOptions chromeDesktopOptions = chromeOptions(false);
driver = useRemote ? new RemoteWebDriver(gridURL, chromeDesktopOptions) : new ChromeDriver(chromeDesktopOptions);
break;
case NEXUS_5:
realDevice = checkForRealDevice();
if(realDevice) {
driver = new ChromeDriver(chromeOptionsForAndroid());
View file.sh
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
WebDriver driver = new RemoteWebDriver(chromeOptions);
View file.html
<!DOCTYPE html>
<html>
<script src="<https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js>"></script>
<body ng-app="">
<input ng-blur="count = count + 1" ng-init="count=0" />
<h1>{{count}}</h1>
<p>This example will increase the value of the variable "count" every time the input field loses focus.</p>
View file.m
default void setInputText(Supplier<By> by, Object value) {
if (value == null) return;
Element element = await(by);
await((Predicate<SearchScope>) searchScope -> {
element.clear();
return element.getValue().isEmpty();
});
String stringValue = value.toString();
element.sendKeys(stringValue);
assert stringValue.equals(element.getValue());
View file.m
default void setInputTextWithAction(Supplier<By> by, Object value) {
if (value == null) return;
String stringValue = value.toString();
Element element = await(by);
element.click();
element.sendKeys(END);
while (!element.getValue().isEmpty()) {
element.sendKeys(BACK_SPACE);
}
element.sendKeys(stringValue);
View file.py
if ENV.has_key?('TEST_SERVER_HTTP_HOST')
require 'support/capybara/selenium_remote_firefox'
Capybara.javascript_driver = :selenium_remote_firefox
Capybara.register_driver :selenium_remote_firefox do |app|
Capybara::Selenium::Driver.new(
app,
browser: :remote,
url: "http://#{ENV['SELENIUM_HOST']}:#{ENV['SELENIUM_PORT']}/wd/hub",