title: How to test an Electron browser using Spectron
body: <p>I'm trying to test my company's Electron built browser <a href="https://github.com/maidsafe/safe_browser" rel="nofollow noreferrer">https://github.com/maidsafe/safe_browser</a> but am meeting a few challenges which I am looking for support / guidance with.</p>
  
  <p>After a fair amount of research, it seems I essentially have two options - using Spectron as the test framework or Selenium with Chromedriver. I found a means to use a custom binary with Selenium by using Chrome Options and supplying the path to the browser executable and thought I was on to a winner with that but I hit a major issue - I could launch the browser but any interaction I tried (using the "typical" test automation approach I previously learn with Selenium Java) failed:</p>
  
  <p>Eg <code>WebElement secret = driver.findElement(By.cssSelector("#acc-secret"));</code> </p>
  
  <p>would not work - I got</p>
  
  <p><code>org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"#acc-secret"}</code></p>
  
  <p>I also tried to interact with the element by Id and by xpath - none of which worked. I tried the different <code>findElement</code> methods with different on screen elements and could not get anything to work.</p>
  
  <p>So, I gave up on that approach for the time being - if this had worked it would have been ideal as my automation experience lies with Selenium Java. It's OK though, I'm happy to learn new stuff, so I looked into Spectron.</p>
  
  <p>However, I have found the documentation / blog posts around Spectron difficult to digest - I am a tester rather than a dev and, while I am technically competent, I found the level of assumed knowledge here higher than I currently possess. Plus, it all seems to be Javascript which I have little knowledge of. (This was why I was hoping to go be able to go the Selenium route which I am familiar with.)</p>
  
  <p>What I want to do is to create a suite of tests independent of the browser's codebase where we (QA team) can build eg Page Object Models and associated test cases.</p>
  
  <p>Any ideas / suggestions / guidance would be most gratefully received as I feel that I am not really getting far at the  moment!</p>