Skip to content

Instantly share code, notes, and snippets.

@MatthewSteeples
Last active December 19, 2015 09:29
Show Gist options
  • Save MatthewSteeples/5932913 to your computer and use it in GitHub Desktop.
Save MatthewSteeples/5932913 to your computer and use it in GitHub Desktop.
Automated Test
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Support.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WebWork
{
static class Program
{
static void Main(string[] args)
{
//using (var driver = new InternetExplorerDriver())
using (var driver = new ChromeDriver())
{
driver.Navigate().GoToUrl("https://e2e.qbo.intuit.com/qbo10/redir/startuphere?locale=en_GB&bc=UKP-FRE");
driver.SwitchTo().Frame("contentframe");
var linkTbl = (RemoteWebElement)driver.FindElementById("section1_switchtoexistinglogin");
var link = linkTbl.FindElementByCssSelector("a");
link.Click();
//Works
driver.SetValue("createco_existingloginname", "usernameFromJs");
driver.SetValue("createco_existingpassword", "jsPassword");
//Doesn't work
var userName = driver.FindElementById("createco_existingloginname");
//userName.Click();
//userName.Clear();
userName.SendKeys("usernameFromRemoteElement");
var password = driver.FindElementById("createco_existingpassword");
//password.Click();
//password.Clear();
password.SendKeys("remoteElementPassword");
}
}
static void SetValue(this RemoteWebDriver driver, string id, string value)
{
driver.ExecuteScript("document.getElementById('" + id + "').setAttribute('value', '" + value + "');");
}
}
}
Started ChromeDriver (v2.0) on port 53252
[0.971][INFO]: received WebDriver request: GET /status
[0.972][INFO]: sending WebDriver response: 200 {
"sessionId": "",
"status": 0,
"value": {
"build": {
"version": "alpha"
},
"os": {
"arch": "x86_64",
"name": "Windows NT",
"version": "6.2"
}
}
}
[0.974][INFO]: received WebDriver request: POST /session {
"desiredCapabilities": {
"browserName": "chrome",
"chrome.switches": [ ],
"chromeOptions": {
"args": [ ],
"extensions": [ ]
},
"javascriptEnabled": true,
"platform": "WINDOWS",
"version": ""
}
}
[0.992][INFO]: Launching chrome: "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --remote-debugging-port=53256 --no-first-run --enable-logging --logging-level=1 --user-data-dir="C:\Users\Matthew\AppData\Local\Temp\scoped_dir916_4413" --load-extension="C:\Users\Matthew\AppData\Local\Temp\scoped_dir916_11475\internal" --ignore-certificate-errors data:text/html;charset=utf-8,
[1.332][INFO]: sendingWebDriverresponse:303
[1.333][INFO]: received ebDriver request: GET /session/eb16a6bad6445c1d0bf9cb718
62ad531
[1.334][INFO]: sending WebDriver response: 200 {
"sessionId": "eb16a6bad6445c1d0bf9cb71862ad531",
"status": 0,
"value": {
"acceptSslCerts": true,
"applicationCacheEnabled": false,
"browserConnectionEnabled": false,
"browserName": "chrome",
"chrome": {
"chromedriverVersion": "2.0"
},
"cssSelectorsEnabled": true,
"databaseEnabled": true,
"handlesAlerts": true,
"javascriptEnabled": true,
"locationContextEnabled": true,
"nativeEvents": true,
"platform": "Windows NT",
"rotatable": false,
"takesScreenshot": true,
"version": "27.0.1453.116",
"webStorageEnabled": true
}
}
[1.337][INFO]: received WebDriver request: POST /session/eb16a6bad6445c1d0b9cb71
862ad531/url {
"url": "https://e2e.qbo.intuit.com/qbo10/redir/startuphere?locale=en_GB&bc=UKP-FRE"
}
[1.359][INFO]: waiting for pending navigations...
[1.375][INFO]: done waiting for pending navigations
[1.458][INFO]: waiting for pending navigations...
[7416:5552:0705/092919:ERROR:ipc_channel_win.cc(132)] pipe error: 109
[11356:6296:0705/092921:ERROR:textfield.h(162)] NOT IMPLEMENTED
[8.472][INFO]: done waiting for pending navigations
[8.473][INFO]: sending WebDriver response: 200 {
"sessiond": "eb16a6bad6445c1d0bf9cb71862ad531",
"status": 0,
"value": null
}
[8.475][INFO]: received WebDriver request: POST /session/eb16a6bad6445c1d0bf9cb71862ad531/frame {
"id": "contentframe"
}
[8.475][INFO]: waiting for pending navigations...
[8.475][INFO]: done waiting for pending navigations
[8.485][INFO]: waiting for pending navigations...
[8.485][INFO]: done waiting for pending navigations
[8.485][INFO]: sending WebDriver response: 200 {
"sessionId": "eb16a6bad6445c1d0bf9cb71862ad531",
"status": 0,
"value": null
}
[8.487][INFO]: received WebDriver request: GET /session/eb16a6bad6445c1d0bf9cb71862ad531/url
[8.488][INFO]: waiting for pending navigations...
[8.488][INFO]: done waiting for pending navigations
[8.491][INFO]: waiting for pending navigations...
[8.491][INFO]: done waiting for pending navigations
[8.491][INFO]: sending WebDriver response: 200 {
"sessionId": "eb16a6bad6445c1d0bf9cb71862ad531",
"status": 0,
"value": "https://e2e.qbo.intuit.com/c10/v63.121/0/ext/CreateCo/startup?bc=UKP-FRE&locale=en_GB"
}
[8.492][INFO]: received WebDriver request: GET /session/eb16a6bad6445c1d0bf9cb71862ad531/title
[8.492][INFO]: waiting for pending navigations...
[8.493][INFO]: done waiting for pending navigations
[8.495][INFO]: waiting for pending navigations...
[8.495][INFO]: done waiting for pending navigations
[8.495][INFO]: sending WebDriver response: 200 {
"sessionId": "eb16a6bad6445c1d0bf9cb71862ad531",
"status": 0,
"value": "QuickBooks Online Plus"
}
[8.496][INFO]: received WebDriver request: GET /session/eb16a6bad6445c1d0bf9cb71862ad531/source
[8.496][INFO]: waiting for pending navigations...
[8.497][INFO]: done waiting for pending navigations
[8.524][INFO]: waiting for pending navigations...
[8.524][INFO]: done waiting for pending navigations
[8.540][INFO]: sending WebDriver response: 200 {
"sessionId": "eb16a6bad6445c1d0bf9cb71862ad531",
"status": 0,
"value": "\u003Chtml\u003E\u003C!--Copyright 2000, Intuit Inc. All rights re
served. !--\u003E\u003C!--This material contains proprietary information of Intu
it Inc. !--\u003E\u003C!--Use, reproduction or distribution without express writ
ten p..."
}
[8.561][INFO]: received WebDriver request: GET /session/eb16a6bad6445c1d0bf9cb71862ad531/window_andle
[8.561][INFO]: sending WebDriver response: 200 {
"sessionId": "eb16a6bad6445c1d0bf9cb71862ad531",
"status": 0,
"value": "CDwindow-531554EC-E230-48F9-BE6B-CD2B5D2E9814"
}
[8.562][INFO]: received WebDriver request: GET /session/eb16a6bad6445c1d0bf9cb71862ad531/window_handles
[8.563][INFO]: sending WebDriver response: 200 {
"sessionId": "eb16a6bad6445c1d0bf9cb7162ad531",
"status": 0,
"value": [ "CDwindow-531554EC-E230-4F9-BE6B-CD2B5D2E914" ]
}
[10.594][INFO]: received WebDriver request: POST /session/eb16a6bad6445c1d0bf9cb71862ad531/element {
"using": "id",
"value": "section1_switchtoexistinglogin"
}
[10.595][INFO]: waiting for pending navigations...
[10.595][INFO]: done waiting for pending navigations
[10.615][INFO]: waiting for pending navigations...
[10.616][INFO]: done waiting for pending navigations
[10.616][INFO]: sending WebDriver response: 200 {
"sessionId": "eb16a6bad6445c1d0bf9cb71862ad531",
"status": 0,
"value": {
"ELEMENT": "0.6839276659302413:1"
}
}
[10.617][INFO]: received WebDriver request: POST /session/eb16a6bad6445c1d0bf9cb71862ad531/element/0.6839276659302413:1/element {
"using": "css selector",
"value": "a"
}
[10.618][INFO]: waiting for pending navigations...
[10.618][INFO]: done waiting for pending navigations
[10.637][INFO]: waiting for pending navigations...
[10.637][INFO]: done waiting for pending navigations
[10.637][INFO]: sending WebDriver response: 200 {
"sessionId": "eb16a6bad6445c1d0bf9cb71862ad531",
"status": 0,
"value": {
"ELEMET": "0.6839276659302413:2"
}
}
[10.638][INFO]: received WebDriver request: POST /session/eb16a6bad6445c1d0bf9cb71862ad531/element/0.6839276659302413:2/click
[10.639][INFO]: waiting for pending navigations...
[10.639][INFO]: done waiting for pending navigations
[10.724][INFO]: waiting for pending navigations...
[10.724][INFO]: done waiting for pending navigations
[10.725][INFO]: sending WebDriver response: 200 {
"sessionId": "eb16a6bad6445c1d0bf9cb71862ad531",
"status": 0,
"value": null
}
[10.726][INFO]: received WebDriver request: POST /session/eb16a6bad6445c1d0bf9cb71862ad531/element {
"using": "id",
"value": "createco_existingloginname"
}
[10.726][INFO]: waiting for ending navigations...
[10.727][INFO]: done waiting for pending navigations
[10.748][INFO]: waiting for pending navigations...
[10.748][INFO]: done waiting for pending navigations
[10.748][INFO]: sending WebDriver response: 200 {
"sessionId": "eb16a6bad6445c1d0bf9cb71862ad531",
"status": 0,
"value": {
"ELEMENT": "0.6839276659302413:3"
}
}
[10.750][INFO]: received WebDriver request: POST /session/eb16a6bad6445c1dbf9cb71862ad531/element/.683927665932413:3/click
[10.750][INFO]: waiting for pending navigations...
[10.750][INFO]: done waiting for pending navigations
[10.806][INFO]: waiting for pending navigations...
[10.806][INFO]: done waiting for pending navigations
[10.807][INFO]: sending WebDriver response: 200 {
"sessionId": "eb16a6bad6445c1d0bf9cb71862ad531",
"status": 0,
"value": null
}
[10.808][INFO]: received WebDriver request: POST /session/eb16a6bad6445c1d0bf9cb71862ad531/element/0.6839276659302413:3/clear
[10.808][INFO]: waiting for pending navigations...
[10.808][INFO]: done waiting for pending navigations
[10.834][INFO]: waiting for pending navigations...
[10.834][INFO]: done waiting for pending navigations
[10.835][INFO]: sending WebDriver response: 200 {
"sessionId": "eb16a6bad6445c1d0bf9cb7162ad531",
"status": 0,
"value": null
}
[10.836][INFO]: receivedWebDriverrequest:POST/session/eb16a6bad6445c1d0bf9cb71862ad531/element/0.6839276659302413:3/value{
"value":["u","s","e","r","n","a","m","e","F","r","o","m","R","e","m","o","t","e"
,"E","l","e","m","e","n","t"]
}
[10.836][INFO]: waitingforpendingnavigations...
[10.837][INFO]: done waiting for pending navigations
[10.914][INFO]: waiting for pending navigations...
[10.914][INFO]: done waiting for pending navigations
[10.914][INFO]: sending WebDriver response: 200 {
"sessionId": "eb16a6bad6445c1d0bf9cb71862ad531",
"status": 0,
"value": null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment