I'm having trouble finding a table from DOCTYPE Html using xpath or className in Selenium/java. I can't seem to locate the locator. How can I retrieve the table using selenium java? Neither of the following paths are effective.
You can view a screenshot of the table at Table screenshot
WebElement tableElement= driver.findElement(By.className("table table-striped"));
WebElement tableElement1 = driver.findElement(By.xpath("/html/body/div[2]/div[2]/div/div/div/div/table/tbody"));
I want to extract all rows in the table through selenium.
The errors I am encountering are:
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[2]/div[2]/div/div/div/div/table/tbody"}
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":".table\.table\-striped"}