1. Can't find element
Use Sleep with long time then down the time to proper value. For example, insert Thread.sleep(10000) (= 10 seconds) and see result.
If you have already found the element, decrease the time to reduce the latency.
2. Can't find element inside <svg> tag
SVG stands for Scalable Vector Graphics. SVG defines vector-based graphics in XML format. SVG defines the graphics in XML format. (W3schools)
If can't using xpath, try this:
List<WebElement> data = driver.findElements(By.xpath("//*[name()='svg']));
Then debug to check data.size() to ensure you can get svg tag first.
Next, continue to get element inside svg. For example your value in a <g> tag:
List<WebElement> data = driver.findElements(By.xpath("//*[name()='svg']/*[name()='g']"));
Debug to check data, you can use data.get(i).getAttribute("classname") (i from 0 to data.size(), can replace "classname" by any attribute in the element which you guess) to examine what exactly data contains. And maybe you find the value i is the element that you need.
If your element inside a tag which is inside svg (my bad English :( , continue to find it like:
List<WebElement> data = driver.findElements(By.xpath("//*[name()='svg']/*[name()='g']/*[name()='g']"));
Always using debug mode to find your element that you need, sometime u can use data.remove to delete element that not necessary for your process.
Không có nhận xét nào:
Đăng nhận xét