In order to test an electron application. How does one use selenium to identify its elements or using F12 dev tools? As in order to write a selenium script one would have to identify the elements initially. How do I decompose an electron application to view its elements? Suggestions?
4 Answers
For this question, it depends on which webdriver Selenium is using. I am testing with Spectron based on Electron, but my elements are identified by webdriver IO
.
To reach an element you can use the id, class, CSS or xPath
Next up I can get an element and do whatever I want with it
browser.element(selector); // Default
browser.element('#id');
browser.element('.class');
browser.element('.multiple.classes.to.find.element');
browser.element('//xpath');
I have followed the documentation at https://electronjs.org/docs/tutorial/using-selenium-and-webdriver and I was able to capture the elements.