I had to start using Selenium recently as a website that I crawled had updated to javascript, after seeking some advise here Selenium was recommended as the program of choice in this situation.
Using Selenium I am now able to crawl the website and "roughly" get what I want but I would like some guidance on how to select the different elements that I gathered when I crawled the Table. For example, When I use J-Soup to gather the data I get the Whole table like so:
docVTS = Jsoup.connect("http://********************").timeout(10000).get();
Elements table = docVTS.select("table.dynlist");
Then I can gather the different parts of that table like this:
Elements number = table.select("td:eq(0)");
vtsInt = number.size();
for (int i = 0; i < vtsInt; i++) {
ships = table.select("td:eq(1)").get(i).text().replace(" ","");
arr_ships.add(ships);
dwt = table.select("td:eq(3)").get(i).text().replace(" ","");
arr_dwt.add(dwt);
Is it possible to do the same with Selenium?
I currently have:
String text = driver.findElement(By.xpath("//div[@id='cphBody_Report_grid']")).getText();
This gets the table but I am unsure as to how I could select the different parts of the table like I do in j-soup. I would welcome any advice. Thank you.
Edit: I found this CookBook for Selenium and selectors in general and found it rather helpful when starting with selenium: https://www.simple-talk.com/dotnet/.net-framework/xpath,-css,-dom-and-selenium-the-rosetta-stone/