I often have to run test cases on a site I work on. Most of the time I only need to check that an element exists on a site, or I have to scrape a bit of data of the site. Up until now I have been using Jsoup to do this work.
I have recently been introduced to Selenium Webdriver. I have been doing a bit of reading about it but am just trying to figure out when it is best to use it. In cases like mine, checking if an element exists on a page or scraping data I presume I would still be better off using Jsoup? And Selenium would be best suited for filling out forms and clicking buttons on a site?
Selenium has the advantage that it runs an actual browser, it will therefore execute all the JS and so forth in a way that's very, very close to an actual user of the site. The API further allows you to write your tests in a language that's close to the actual interactions (e.g. click
to click on a link).
So if you do have tests that have some form of interactions (forms, links, etc.) The overhead of Selenium is worth it. If you simply want to open an URL and check for the existence of some content Jsoup will do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With