Hailong Zhang

Hailong Zhang

  • NA
  • 6
  • 524

A scraping issue on C# scraping project

Jun 30 2020 1:11 PM
I wish everybody has a good day! I am new to building scraping project in c#. Now I am trying to scrape the content of a tag href property from a web-site. but could not come to good conclusion yet! Here is the structure of web-page:
  1. <table class="matches date_matches grouped">   
  2. <thead>  
  3. </thead>   
  4. <tbody>   
  5.    <tr id="date_matches-16-53658" class="group-head clickable" stage-value="212">   
  6.       <th colspan="5"> </th>  
  7.        <th class="competition-link">   
  8.          <a href="/national/south-africa/psl/20192020/regular-season/r53038/"><span>More…</span></a>   
  9.       </th> </tr>   
  10.    <tr id="xxx"> ... </tr>   
  11. </tbody>  
  12. </table>  
I am going to scrape the content of href url-link string (Here: "/national/south-africa/psl/20192020/regular-season/r53038/").
 
Here is my c# scraping project:
  1. using OpenQA.Selenium;  
  2. using OpenQA.Selenium.Chrome;  
  3. ...  
  4. IWebDriver driver = new ChromeDriver();  
  5. driver.Navigate().GoToUrl("https://...."); ReadOnlyCollection<IWebElement>  
  6. alinks = driver.FindElements(By.XPath("//td[@class='score-time']/a[contains(@href, 'south-africa')]"));  
I tried in some other ways for scraping the content of href property.
 
but still not get the correct result. Thanks in good advice!!!

Answers (2)