A similar error on startup: (JavaScript)
this.driver.executeScript(function () {
chrome.runtime.sendMessage('start');
});
WebDriverError: unknown error: Cannot read property 'sendMessage' of undefined
, chrome.runtime , . ( Incognito , .) , - WebDriver.
, , :
https://groups.google.com/forum/#!topic/chromedriver-users/7wF9EHF2jxQ
options.excludeSwitches('test-type');
builder.setChromeOptions(options);
, :
WebDriverError: unknown error: Invalid arguments to connect.
, , Chrome, . :.
"externally_connectable": {
"matches": [
"http://localhost:8000/mytest.html"
]
}
sendMessage:
this.driver.executeScript(function () {
chrome.runtime.sendMessage('kjnfjpehjfekjjhcgkodhnpfkoalhehl', 'start');
});
.
- , MGR , script sendMessage, , .
, , , script, sendMessage:
:
this.driver.executeScript(function () {
var event = document.createEvent('HTMLEvents');
event.initEvent('extension-button-click', true, true);
document.dispatchEvent(event);
});
script :
"content_scripts": [
{ "matches": ["<all_urls>"], "js": ["content_script.js"] }
]
content_script.js:
document.addEventListener('extension-button-click', function () {
chrome.runtime.sendMessage('start');
});
,