Search code examples
c#seleniumselenium-webdriverelectronspectron

Linking selenium with electron framework (c#)


I've already written few lines of code in C# using Selenium webdriver. As my application was transferred to the Electron framework everything has changed and honestly, I don't know how to cope with it right now.

Could you please clarify it to me? What steps should I take to simple start... I would like to continue my work in the current project (selenium, C#), but I'm not sure that it's possible, or I should completely start from scratch using a different language and framework?

I've read about Spectron, and checked the internet resources like stackoverflow, however I'm still in the point of unawareness...


Solution

  • Spectron with mocha is supposed to be faster.

    But still here is what you need.This is Java & Selenium.

    System.setProperty("webdriver.chrome.driver","C:\\electron-chromedriver\\bin\\chromedriver.exe");
    ChromeOptions chromeOptions = new ChromeOptions();
    chromeOptions.setBinary("C:\\Users\\app.exe");
    chromeOptions.addArguments("start-maximized");
    DesiredCapabilities capability = new DesiredCapabilities();
    capability.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
    capability.setCapability("chromeOptions", chromeOptions);       
    driver = new ChromeDriver(chromeOptions);  
    

    I have used the packaged electron app for binary (i.e) app.exe .

    I think this is what you need.