Skip to content

Instantly share code, notes, and snippets.

driver.Url = "https://www.qat2.weightwatchers.com/us/";
IWebElement element = driver.FindElement(By.CssSelector(".menu-link__inner-wrapper"));
element = self.browser.find_element_by_id("send2")
self.browser.execute_script("arguments[0].style.border='5px solid red';", element)
// Line 1198 of window_commands.cc
base::char16 key = raw_key[0];
// TODO: understand necessary_modifiers
int necessary_modifiers = 0;
ui::KeyboardCode key_code = ui::VKEY_UNKNOWN;
// Modifications begin here
bool should_skip = false;
if (!KeyCodeFromSpecialWebDriverKey(key, &key_code) &&
!KeyCodeFromShorthandKey(key, &key_code, &should_skip) {
std::string error_msg;
// The below code excerpt begins at line 997 of window_commands.cc in ProcessInputActionSequence
} else if (type == "key") {
// process key action
std::string subtype;
if (!action_item->GetString("type", &subtype) ||
(subtype != "keyUp" && subtype != "keyDown" && subtype != "pause"))
return Status(
kInvalidArgument,
"type of action must be the string 'keyUp', 'keyDown' or 'pause'");
action->SetString("id", id);
@jimevans
jimevans / gist:2b038b5c8dbc8e58e49a99bff33f2d27
Created September 10, 2018 21:47
selenium web server command line
java -cp buck-out\gen\java\client\test\org\openqa\selenium\environment\webserver.jar org.openqa.selenium.environment.webserver.JettyAppServer
ChromeOptions options = new ChromeOptions();
HttpCommandExecutor executor = new HttpCommandExecutor(new Uri("http://ondemand.saucelabs.com"), TimeSpan.FromSeconds(60));
// Set up your proxy here.
executor.Proxy = new System.Net.WebProxy();
IWebDriver driver = new RemoteWebDriver(executor, options.ToCapabilities());
[Test]
public void SimpleSelenium4Example()
{
//TODO please supply your Sauce Labs user name in an environment variable
var sauceUserName = Environment.GetEnvironmentVariable("SAUCE_USERNAME", EnvironmentVariableTarget.User);
//TODO please supply your own Sauce Labs access Key in an environment variable
var sauceAccessKey = Environment.GetEnvironmentVariable("SAUCE_ACCESS_KEY", EnvironmentVariableTarget.User);
var options = new EdgeOptions()
{
[Test]
public void ClickLabelTest()
{
driver.Url = EnvironmentManager.Instance.UrlBuilder.CreateInlinePage(new InlinePage()
.WithBody(
"<label id='wrapper'>wraps a checkbox <input id='check' type='checkbox' checked='checked' style='display:none'/></label>"));
IWebElement label = driver.FindElement(By.Id("wrapper"));
label.Click();
IWebElement checkbox = driver.FindElement(By.Id("check"));
Assert.IsFalse(checkbox.Selected);
{
"sessionId":"c8e250efce0ee5d78fef4e0d05962cdf",
"status":0,
"value":{
"acceptInsecureCerts":false,
"acceptSslCerts":false,
"applicationCacheEnabled":false,
"browserConnectionEnabled":false,"
browserName":"chrome",
"chrome":{
# reminder: '\uE008' is the Shift key
{ "actions": [
{
"type": "key",
"id": "default keyboard",
"actions": [
{ "type": "keyDown", "value": "\uE008" },
{ "type": "keyDown", "value": "a" },
{ "type": "keyUp", "value": "a" },