Max is a life enhancer for tech & entrepreneurship. Which seeks to blend both to build innovative products or services for the world that solves hard problems.
Hmmm... for me I choose XPath because it's much easier to read and modify which using CSS fails me in extracting data.
As there were times I need to extract data and makes changes to each value in the rows of a table then save it as an element in either a dictionary or list data type variable.
Especially you are extracting listings data. Which you can program your Data Scrapper to stop at specific rows using just for loop.
After getting the total number of rows from somewhere within the page or derived from checking the usual max number of rows in the table html element.
Max is a life enhancer for tech & entrepreneurship. Which seeks to blend both to build innovative products or services for the world that solves hard problems.
Interesting perspective as I had used protractor and did find that it was quite limited in features to test UI which I usually fall back to using selenium due to me playing around with it in the past by doing data scrapping projects.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hmmm... for me I choose XPath because it's much easier to read and modify which using CSS fails me in extracting data.
As there were times I need to extract data and makes changes to each value in the rows of a table then save it as an element in either a dictionary or list data type variable.
Especially you are extracting listings data. Which you can program your Data Scrapper to stop at specific rows using just for loop.
After getting the total number of rows from somewhere within the page or derived from checking the usual max number of rows in the table html element.
XPaths do have an advantage, you can use them to locate an element based on the text inside.
It's great to use both CSS Selectors and XPaths.
And it's also very helpful to learn how to write your own XPaths and CSS Selectors by using attributes which make an element unique.
The XPaths and CSS Selectors that you get from the Chrome Developer Console.
Let's take a look at this example:
We can easily spot that the IDs are dynamic, so we have to avoid them.
The basic CSS Selector for the Email input would look like this:
But we can easily construct something more reliable:
And using Cypress or any other JavaScript-based UI testing library is a very bad idea.
Since those libraries have severe limitations and do not mimic real user behavior.
For example, a JavaScript-based library for testing the UI can easily click on an element which is completely covered by another element.
A real user and a Selenium test cannot do that.
A JavaScript library for testing the UI cannot perform file uploads, cannot manage iframes and cannot manage multiple browser tabs.
Use Selenium or some other Selenium-based solution. That's the way to go.
Interesting perspective as I had used protractor and did find that it was quite limited in features to test UI which I usually fall back to using selenium due to me playing around with it in the past by doing data scrapping projects.