Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium Webdriver vs Jsoup - When to use [closed]

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?

like image 547
Peck3277 Avatar asked Dec 20 '13 11:12

Peck3277


Video Answer


1 Answers

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.

like image 123
reto Avatar answered Oct 13 '22 07:10

reto