Connecting selenium driver to CEF desktop application











up vote
0
down vote

favorite












I want to use Selenium WebDriver to run automated tests in a CEF window that is embedded in an application. When i run application with debug console enabled, and then i start my test i'm getting following error:




SessionNotCreatedException: Message: session not created from unknown error: unhandled inspector error: ("code":-32601, "message":"'Target.setAutoAtach' wasn't found")




How can I fix this error? Or there is another way to connect to CEF desktop application?



My C# code:



Cef.Initialize(new CefSettings
{
RemoteDebuggingPort = 55555,
Locale = ResourcesController.GetResource("Locale"),
LogSeverity = LogSeverity.Disable
});
ChromeBrowser = new ChromiumWebBrowser(mainHtml)
{
Dock = DockStyle.Fill,
BrowserSettings = new BrowserSettings
{
FileAccessFromFileUrls = CefState.Enabled,
UniversalAccessFromFileUrls = CefState.Enabled,
},
MenuHandler = new CustomContextMenuHandler()
};


And automation test in python:



import unittest
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import os

CEF_PORT = "55555"
DEBUGGER_ADDRESS = "localhost:{}".format(CEF_PORT)
CHROMEDRIVER_PATH = "C:chromedriverchromedriver.exe"
os.environ["PATH"] += os.pathsep + r'C:chromedriver'

class LoginTest(unittest.TestCase):
window_handle_main = None

def setUp(cls):
options = webdriver.ChromeOptions()
options.debugger_address = DEBUGGER_ADDRESS

def test_button_login_click(self):
WebDriverWait(self.instance, 5).until(ec.presence_of_element_located((By.ID, "btnLogin")))
self.instance.find_element_by_id("btnLogin").click()

def tearDown(self):
self.instance.close()

if __name__ == "__main__":
unittest.main()


I'm using latest version of chromedriver (2.43).










share|improve this question






















  • The official CEF guide is bitbucket.org/chromiumembedded/cef/wiki/UsingChromeDriver.md Last I checked you couldn't attach Selenium to an already running instance, has this changed?
    – amaitland
    Nov 9 at 5:42










  • No and i'm out of ideas. Now i'm trying to start application from selenium test code like in youtube.com/watch?v=xfyDIz7Mk0U. I'll edit main post if i have any updates.
    – Krystian721
    Nov 9 at 8:31

















up vote
0
down vote

favorite












I want to use Selenium WebDriver to run automated tests in a CEF window that is embedded in an application. When i run application with debug console enabled, and then i start my test i'm getting following error:




SessionNotCreatedException: Message: session not created from unknown error: unhandled inspector error: ("code":-32601, "message":"'Target.setAutoAtach' wasn't found")




How can I fix this error? Or there is another way to connect to CEF desktop application?



My C# code:



Cef.Initialize(new CefSettings
{
RemoteDebuggingPort = 55555,
Locale = ResourcesController.GetResource("Locale"),
LogSeverity = LogSeverity.Disable
});
ChromeBrowser = new ChromiumWebBrowser(mainHtml)
{
Dock = DockStyle.Fill,
BrowserSettings = new BrowserSettings
{
FileAccessFromFileUrls = CefState.Enabled,
UniversalAccessFromFileUrls = CefState.Enabled,
},
MenuHandler = new CustomContextMenuHandler()
};


And automation test in python:



import unittest
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import os

CEF_PORT = "55555"
DEBUGGER_ADDRESS = "localhost:{}".format(CEF_PORT)
CHROMEDRIVER_PATH = "C:chromedriverchromedriver.exe"
os.environ["PATH"] += os.pathsep + r'C:chromedriver'

class LoginTest(unittest.TestCase):
window_handle_main = None

def setUp(cls):
options = webdriver.ChromeOptions()
options.debugger_address = DEBUGGER_ADDRESS

def test_button_login_click(self):
WebDriverWait(self.instance, 5).until(ec.presence_of_element_located((By.ID, "btnLogin")))
self.instance.find_element_by_id("btnLogin").click()

def tearDown(self):
self.instance.close()

if __name__ == "__main__":
unittest.main()


I'm using latest version of chromedriver (2.43).










share|improve this question






















  • The official CEF guide is bitbucket.org/chromiumembedded/cef/wiki/UsingChromeDriver.md Last I checked you couldn't attach Selenium to an already running instance, has this changed?
    – amaitland
    Nov 9 at 5:42










  • No and i'm out of ideas. Now i'm trying to start application from selenium test code like in youtube.com/watch?v=xfyDIz7Mk0U. I'll edit main post if i have any updates.
    – Krystian721
    Nov 9 at 8:31















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I want to use Selenium WebDriver to run automated tests in a CEF window that is embedded in an application. When i run application with debug console enabled, and then i start my test i'm getting following error:




SessionNotCreatedException: Message: session not created from unknown error: unhandled inspector error: ("code":-32601, "message":"'Target.setAutoAtach' wasn't found")




How can I fix this error? Or there is another way to connect to CEF desktop application?



My C# code:



Cef.Initialize(new CefSettings
{
RemoteDebuggingPort = 55555,
Locale = ResourcesController.GetResource("Locale"),
LogSeverity = LogSeverity.Disable
});
ChromeBrowser = new ChromiumWebBrowser(mainHtml)
{
Dock = DockStyle.Fill,
BrowserSettings = new BrowserSettings
{
FileAccessFromFileUrls = CefState.Enabled,
UniversalAccessFromFileUrls = CefState.Enabled,
},
MenuHandler = new CustomContextMenuHandler()
};


And automation test in python:



import unittest
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import os

CEF_PORT = "55555"
DEBUGGER_ADDRESS = "localhost:{}".format(CEF_PORT)
CHROMEDRIVER_PATH = "C:chromedriverchromedriver.exe"
os.environ["PATH"] += os.pathsep + r'C:chromedriver'

class LoginTest(unittest.TestCase):
window_handle_main = None

def setUp(cls):
options = webdriver.ChromeOptions()
options.debugger_address = DEBUGGER_ADDRESS

def test_button_login_click(self):
WebDriverWait(self.instance, 5).until(ec.presence_of_element_located((By.ID, "btnLogin")))
self.instance.find_element_by_id("btnLogin").click()

def tearDown(self):
self.instance.close()

if __name__ == "__main__":
unittest.main()


I'm using latest version of chromedriver (2.43).










share|improve this question













I want to use Selenium WebDriver to run automated tests in a CEF window that is embedded in an application. When i run application with debug console enabled, and then i start my test i'm getting following error:




SessionNotCreatedException: Message: session not created from unknown error: unhandled inspector error: ("code":-32601, "message":"'Target.setAutoAtach' wasn't found")




How can I fix this error? Or there is another way to connect to CEF desktop application?



My C# code:



Cef.Initialize(new CefSettings
{
RemoteDebuggingPort = 55555,
Locale = ResourcesController.GetResource("Locale"),
LogSeverity = LogSeverity.Disable
});
ChromeBrowser = new ChromiumWebBrowser(mainHtml)
{
Dock = DockStyle.Fill,
BrowserSettings = new BrowserSettings
{
FileAccessFromFileUrls = CefState.Enabled,
UniversalAccessFromFileUrls = CefState.Enabled,
},
MenuHandler = new CustomContextMenuHandler()
};


And automation test in python:



import unittest
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
import os

CEF_PORT = "55555"
DEBUGGER_ADDRESS = "localhost:{}".format(CEF_PORT)
CHROMEDRIVER_PATH = "C:chromedriverchromedriver.exe"
os.environ["PATH"] += os.pathsep + r'C:chromedriver'

class LoginTest(unittest.TestCase):
window_handle_main = None

def setUp(cls):
options = webdriver.ChromeOptions()
options.debugger_address = DEBUGGER_ADDRESS

def test_button_login_click(self):
WebDriverWait(self.instance, 5).until(ec.presence_of_element_located((By.ID, "btnLogin")))
self.instance.find_element_by_id("btnLogin").click()

def tearDown(self):
self.instance.close()

if __name__ == "__main__":
unittest.main()


I'm using latest version of chromedriver (2.43).







python selenium chromium-embedded






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 8 at 18:41









Krystian721

32




32












  • The official CEF guide is bitbucket.org/chromiumembedded/cef/wiki/UsingChromeDriver.md Last I checked you couldn't attach Selenium to an already running instance, has this changed?
    – amaitland
    Nov 9 at 5:42










  • No and i'm out of ideas. Now i'm trying to start application from selenium test code like in youtube.com/watch?v=xfyDIz7Mk0U. I'll edit main post if i have any updates.
    – Krystian721
    Nov 9 at 8:31




















  • The official CEF guide is bitbucket.org/chromiumembedded/cef/wiki/UsingChromeDriver.md Last I checked you couldn't attach Selenium to an already running instance, has this changed?
    – amaitland
    Nov 9 at 5:42










  • No and i'm out of ideas. Now i'm trying to start application from selenium test code like in youtube.com/watch?v=xfyDIz7Mk0U. I'll edit main post if i have any updates.
    – Krystian721
    Nov 9 at 8:31


















The official CEF guide is bitbucket.org/chromiumembedded/cef/wiki/UsingChromeDriver.md Last I checked you couldn't attach Selenium to an already running instance, has this changed?
– amaitland
Nov 9 at 5:42




The official CEF guide is bitbucket.org/chromiumembedded/cef/wiki/UsingChromeDriver.md Last I checked you couldn't attach Selenium to an already running instance, has this changed?
– amaitland
Nov 9 at 5:42












No and i'm out of ideas. Now i'm trying to start application from selenium test code like in youtube.com/watch?v=xfyDIz7Mk0U. I'll edit main post if i have any updates.
– Krystian721
Nov 9 at 8:31






No and i'm out of ideas. Now i'm trying to start application from selenium test code like in youtube.com/watch?v=xfyDIz7Mk0U. I'll edit main post if i have any updates.
– Krystian721
Nov 9 at 8:31



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53214188%2fconnecting-selenium-driver-to-cef-desktop-application%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53214188%2fconnecting-selenium-driver-to-cef-desktop-application%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini