{"type":"rich","version":"1.0","provider_name":"phorkie","provider_url":"https:\/\/p.cweiske.de\/","title":"WebDriver cli test","author_name":"Christian Weiske","cache_age":86400,"width":900,"height":900,"html":"<!-- embedding all files of https:\/\/p.cweiske.de\/497 -->\n<link rel=\"stylesheet\" href=\"https:\/\/p.cweiske.de\/css\/embed.css\"\/>\n<div class=\"phork\" id=\"497\">\n    <div class=\"phork-file\">\n <div class=\"phork-content\">\n  \n<div class=\"document\">\n\n\n<div class=\"section\" id=\"problems\">\n<h1>Problems<\/h1>\n<p>Elements (via xpath, id or name) are not found with the Firefox driver. Chromium works fine, too.<\/p>\n<p>Reason is that the webdriver spec changed lately, the &quot;web element identifier&quot; is now <tt class=\"docutils literal\"><span class=\"pre\">element-6066-11e4-a52e-4f735466cecf<\/span><\/tt> instead of the previous <tt class=\"docutils literal\">ELEMENT<\/tt>. geckodriver already follows this, chromedriver not.<\/p>\n<p><a class=\"reference external\" href=\"https:\/\/github.com\/instaclick\/php-webdriver\/commit\/be87042314cc654f7ff3e26c20a998cadb23daac\">https:\/\/github.com\/instaclick\/php-webdriver\/commit\/be87042314cc654f7ff3e26c20a998cadb23daac<\/a><\/p>\n<\/div>\n<div class=\"section\" id=\"webdriver-with-firefox\">\n<h1>WebDriver with Firefox<\/h1>\n<p><a class=\"reference external\" href=\"https:\/\/w3c.github.io\/webdriver\/webdriver-spec.html\">https:\/\/w3c.github.io\/webdriver\/webdriver-spec.html<\/a><\/p>\n<ol class=\"arabic\">\n<li><p class=\"first\">Run your local firefox installation in marionette mode:<\/p>\n<pre class=\"literal-block\">\n$  firefox --marionette\n1508154717660       Marionette      INFO    Enabled via --marionette\n1508154718454       Marionette      INFO    Listening on port 2828\n<\/pre>\n<\/li>\n<li><p class=\"first\">Run <a class=\"reference external\" href=\"https:\/\/github.com\/mozilla\/geckodriver\/releases\">geckodriver<\/a> WebDriver proxy:<\/p>\n<pre class=\"literal-block\">\n$ .\/bin\/geckodriver --connect-existing --marionette-port 2828\n1508154721745       geckodriver     INFO    geckodriver 0.19.0\n1508154721755       geckodriver     INFO    Listening on 127.0.0.1:4444\n<\/pre>\n<\/li>\n<li><p class=\"first\">Use <tt class=\"docutils literal\">curl<\/tt> to control it:<\/p>\n<pre class=\"literal-block\">\n$ curl -s -d '{}' http:\/\/localhost:4444\/session | jq .\n{\n  &quot;value&quot;: {\n        &quot;sessionId&quot;: &quot;f1c4ec02-3edc-4308-a0a8-697edd383b9a&quot;,\n        &quot;capabilities&quot;: {\n          &quot;acceptInsecureCerts&quot;: false,\n          &quot;browserName&quot;: &quot;firefox&quot;,\n          &quot;browserVersion&quot;: &quot;56.0&quot;,\n          &quot;moz:accessibilityChecks&quot;: false,\n          &quot;moz:headless&quot;: false,\n          &quot;moz:processID&quot;: 26238,\n          &quot;moz:profile&quot;: &quot;\/home\/cweiske\/.mozilla\/firefox\/u05dh3q4.default&quot;,\n          &quot;pageLoadStrategy&quot;: &quot;normal&quot;,\n          &quot;platformName&quot;: &quot;linux&quot;,\n          &quot;platformVersion&quot;: &quot;4.12.3cw&quot;,\n          &quot;rotatable&quot;: false,\n          &quot;specificationLevel&quot;: 0,\n          &quot;timeouts&quot;: {\n            &quot;implicit&quot;: 0,\n            &quot;pageLoad&quot;: 300000,\n            &quot;script&quot;: 30000\n          }\n        }\n  }\n}\n\n$ session=f1c4ec02-3edc-4308-a0a8-697edd383b9a\n\n$ curl -s -d '{&quot;url&quot;:&quot;http:\/\/example.org&quot;}' http:\/\/localhost:4444\/session\/$session\/url | jq .\n{\n  &quot;value&quot;: {}\n}\n\n$ curl -s  http:\/\/localhost:4444\/session\/$session\/title | jq .\n{\n  &quot;value&quot;: &quot;Example Domain&quot;\n}\n\n$ curl -s  http:\/\/localhost:4444\/session\/$session\/url | jq .\n{\n  &quot;value&quot;: &quot;http:\/\/example.org\/&quot;\n}\n\n$ curl -s -d '{&quot;using&quot;:&quot;xpath&quot;,&quot;value&quot;:&quot;\/\/h1&quot;}'  http:\/\/localhost:4444\/session\/$session\/element | jq .\n{\n  &quot;value&quot;: {\n    &quot;element-6066-11e4-a52e-4f735466cecf&quot;: &quot;4131ac8d-651c-4903-8b04-a591f4f7456f&quot;\n  }\n}\n\n$ curl -s -d '{&quot;using&quot;:&quot;xpath&quot;,&quot;value&quot;:&quot;\/\/h1&quot;}'  http:\/\/localhost:4444\/session\/$session\/elements | jq .\n{\n  &quot;value&quot;: [\n    {\n      &quot;element-6066-11e4-a52e-4f735466cecf&quot;: &quot;30f5c6ca-6fc5-4f23-b331-d102872b4238&quot;\n    }\n  ]\n}\n\n$ curl -s -d '{&quot;using&quot;:&quot;xpath&quot;,&quot;value&quot;:&quot;\/\/doesnotexist&quot;}'  http:\/\/localhost:4444\/session\/$session\/element | jq .\n{\n  &quot;value&quot;: {\n    &quot;error&quot;: &quot;no such element&quot;,\n    &quot;message&quot;: &quot;Unable to locate element: \/\/doesnotexist&quot;,\n    &quot;stacktrace&quot;: &quot;stack backtrace:\\n   0:           0x4f388c - backtrace::backtrace::trace::h736111741fa0878e\\n   1:           0x4f38c2 - backtrace::capture::Backtrace::new::h63b8a5c0787510c9\\n   2:           0x442d88 - webdriver::error::WebDriverError::new::hea6d4dbf778b2b24\\n   3:           0x44cecc - geckodriver::marionette::MarionetteSession::response::h98d048d51a7ee2ba\\n   4:           0x42c729 - &lt;webdriver::server::Dispatcher&lt;T, U&gt;&gt;::run::hba9181b5aacf8f04\\n   5:           0x402c59 - std::sys_common::backtrace::__rust_begin_short_backtrace::h19de262639927233\\n   6:           0x40c065 - std::panicking::try::do_call::h6c1659fc4d01af51\\n   7:           0x5e38ec - panic_unwind::__rust_maybe_catch_panic\\n                        at \/checkout\/src\/libpanic_unwind\/lib.rs:98\\n   8:           0x420d32 - &lt;F as alloc::boxed::FnBox&lt;A&gt;&gt;::call_box::h953e5f59694972c5\\n   9:           0x5dc00b - alloc::boxed::{{impl}}::call_once&lt;(),()&gt;\\n                        at \/checkout\/src\/liballoc\/boxed.rs:661\\n                         - std::sys_common::thread::start_thread\\n                        at \/checkout\/src\/libstd\/sys_common\/thread.rs:21\\n                         - std::sys::imp::thread::{{impl}}::new::thread_start\\n                        at \/checkout\/src\/libstd\/sys\/unix\/thread.rs:84&quot;\n  }\n}\n<\/pre>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n\n <\/div>\n <div class=\"phork-meta\">\n  <a href=\"https:\/\/p.cweiske.de\/497\/rev-raw\/0215bc79acc75cf3365df2426d8f2d1d4fb51c8d\/README.rst\" style=\"float: right\">view raw source<\/a>\n  <a href=\"https:\/\/p.cweiske.de\/497#README.rst\">README.rst<\/a>\n <\/div>\n<\/div>\n    <div class=\"phork-file\">\n <div class=\"phork-content\">\n  \n<div class=\"document\" id=\"chromium\">\n<h1 class=\"title\">Chromium<\/h1>\n\n<ol class=\"arabic\">\n<li><p class=\"first\">Install chromedriver:<\/p>\n<pre class=\"literal-block\">\n$ sudo apt install chromium-chromedriver\n<\/pre>\n<\/li>\n<li><p class=\"first\">Start chromedriver:<\/p>\n<pre class=\"literal-block\">\n$ \/usr\/lib\/chromium-browser\/chromedriver\nStarting ChromeDriver 2.30 on port 9515\nOnly local connections are allowed.\n<\/pre>\n<\/li>\n<li><p class=\"first\">Use curl to talk with chromedriver:<\/p>\n<pre class=\"literal-block\">\n$ curl -s -d '{&quot;desiredCapabilities&quot;:{&quot;browserName&quot;:&quot;chromium&quot;}}' http:\/\/localhost:9515\/session | jq .\n{\n  &quot;sessionId&quot;: &quot;dafbc0093bb64659b23a4b862f3e4a7a&quot;,\n  &quot;status&quot;: 0,\n  &quot;value&quot;: {\n    &quot;acceptSslCerts&quot;: true,\n    &quot;applicationCacheEnabled&quot;: false,\n    &quot;browserConnectionEnabled&quot;: false,\n    &quot;browserName&quot;: &quot;chrome&quot;,\n    &quot;chrome&quot;: {\n      &quot;chromedriverVersion&quot;: &quot;2.30&quot;,\n      &quot;userDataDir&quot;: &quot;\/tmp\/.org.chromium.Chromium.DDa2Ki&quot;\n    },\n    &quot;cssSelectorsEnabled&quot;: true,\n    &quot;databaseEnabled&quot;: false,\n    &quot;handlesAlerts&quot;: true,\n    &quot;hasTouchScreen&quot;: false,\n    &quot;javascriptEnabled&quot;: true,\n    &quot;locationContextEnabled&quot;: true,\n    &quot;mobileEmulationEnabled&quot;: false,\n    &quot;nativeEvents&quot;: true,\n    &quot;networkConnectionEnabled&quot;: false,\n    &quot;pageLoadStrategy&quot;: &quot;normal&quot;,\n    &quot;platform&quot;: &quot;Linux&quot;,\n    &quot;rotatable&quot;: false,\n    &quot;setWindowRect&quot;: true,\n    &quot;takesHeapSnapshot&quot;: true,\n    &quot;takesScreenshot&quot;: true,\n    &quot;unexpectedAlertBehaviour&quot;: &quot;&quot;,\n    &quot;version&quot;: &quot;61.0.3163.100&quot;,\n    &quot;webStorageEnabled&quot;: true\n  }\n}\n\n$ curl -s -d '{&quot;url&quot;:&quot;http:\/\/example.org&quot;}' http:\/\/localhost:9515\/session\/$session\/url | jq .\n{\n  &quot;sessionId&quot;: &quot;dafbc0093bb64659b23a4b862f3e4a7a&quot;,\n  &quot;status&quot;: 0,\n  &quot;value&quot;: null\n}\n\n$ curl -s http:\/\/localhost:9515\/session\/$session\/url | jq .\n{\n  &quot;sessionId&quot;: &quot;dafbc0093bb64659b23a4b862f3e4a7a&quot;,\n  &quot;status&quot;: 0,\n  &quot;value&quot;: &quot;http:\/\/example.org\/&quot;\n}\n\n$ curl -s http:\/\/localhost:9515\/session\/$session\/title | jq .\n{\n  &quot;sessionId&quot;: &quot;dafbc0093bb64659b23a4b862f3e4a7a&quot;,\n  &quot;status&quot;: 0,\n  &quot;value&quot;: &quot;Example Domain&quot;\n}\n\n$ curl -s -d '{&quot;using&quot;:&quot;xpath&quot;,&quot;value&quot;:&quot;\/\/h1&quot;}'  http:\/\/localhost:9515\/session\/$session\/element | jq .\n{\n  &quot;sessionId&quot;: &quot;dafbc0093bb64659b23a4b862f3e4a7a&quot;,\n  &quot;status&quot;: 0,\n  &quot;value&quot;: {\n    &quot;ELEMENT&quot;: &quot;0.2185920045857399-1&quot;\n  }\n}\n\n$ curl -s -d '{&quot;using&quot;:&quot;xpath&quot;,&quot;value&quot;:&quot;\/\/h1&quot;}'  http:\/\/localhost:9515\/session\/$session\/elements | jq .\n{\n  &quot;sessionId&quot;: &quot;dafbc0093bb64659b23a4b862f3e4a7a&quot;,\n  &quot;status&quot;: 0,\n  &quot;value&quot;: [\n    {\n      &quot;ELEMENT&quot;: &quot;0.2185920045857399-1&quot;\n    }\n  ]\n}\n<\/pre>\n<\/li>\n<\/ol>\n<\/div>\n\n <\/div>\n <div class=\"phork-meta\">\n  <a href=\"https:\/\/p.cweiske.de\/497\/rev-raw\/0215bc79acc75cf3365df2426d8f2d1d4fb51c8d\/chrome.rst\" style=\"float: right\">view raw source<\/a>\n  <a href=\"https:\/\/p.cweiske.de\/497#chrome.rst\">chrome.rst<\/a>\n <\/div>\n<\/div>\n<\/div>\n"}
