I am using a data scraper and I know just enough code to not know what I'm doing. The scraper is free and has a crawl limit. There is no option to resume the crawl from end point. I need to scrape all li's on the page. The program will only let me select 1 or all li's. I am trying to come up with a manual selector or xpath that would allow me to select from nth-child(200)on. Any help or suggestions?
Asked
Active
Viewed 52 times
2 Answers
1
You can use the :nth-child()
selector, as you mentioned, and change the functional notation according to your desired rule. You can read more about it and how it works here.
If you set it to :nth-child(n+5)
, the selector will select the fifth element in addition to all the elements that come after it:
li:nth-child(n+5) {
border: 2px solid red;
}
<p>Numbers:</p>
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
</ul>

ChenBr
- 1,671
- 1
- 7
- 21
-1
I figured it out. For this example x and y are the known numbers:
element:nth-child(n+x) = From x forward
element:nth-child(-n+x) = Up to x
element:nth-child(n+x):nth-child(-n+x) = Range between x and y
So for this specific example the solution would be:
element:nth-child(n+200)

fitzgeraldda
- 19
- 1