Yeah same here, the primary reason being that those are the only two major browsers that run on Linux and can be automated using Selenium, so they can be automatically tested in CI. But there are more and more places that only actively test in Chrome, unfortunately.
I use a Java-based Selenium, which I control from Node using WebdriverIO. The latter has a selenium-standalone plugin which ships Selenium, so if you have Java installed, that should be enough. In CI, I run my tests against Selenium's Firefox and Chrome images, which has both the browsers and Selenium set up, so I can just point WDIO to those.
I am using puppeteer headless chrome now, it's not that easy to write, for example, not understanding why it failed to click on a product link no matter how I tried to catch it using different syntax, like page.$$ or page.evaluate() with Javascript and DOM api
I wonder if I should learn Java now to use selenium. I have taken a lot of time to debug all these stuff lol
nonetheless, I am considered to be inexperienced in programming field
I should note that I'm still on the previous version of WebdriverIO, so my setup is probably a little bit different. That said, it appears to say that you need to add a capabilities key to your wdio.conf.js. The documentation of that option is here.
Presumably, if you'd want it to work for Chrome and Firefox, you'd have to add something like this:
is deprecated already really, for example, desiredCapabilities is not enough, capabilities is not set and .init() has been removed as a function don't know since when. I tried to modified the code from
That's great that you figured it out, and shared it for people running into this in the future. As a tip, I'd really recommend you to look into selenium-standalone, so you don't have to start the drivers manually yourself.
16
u/vinnl Apr 08 '19
Yeah same here, the primary reason being that those are the only two major browsers that run on Linux and can be automated using Selenium, so they can be automatically tested in CI. But there are more and more places that only actively test in Chrome, unfortunately.