I would try to select all the IMGs that have those three specific classes:

List<WebElement> listOfElements = driver.findElements(
   By.cssSelector("img[class='x-tree-elbow-img x-tree-elbow-plus x-tree-expander']")
);
listOfElements.get(0).();

The get(0) takes the first found IMG, but you could also use this to click the second if needed.

You can also find elements in other elements. So find the first item of the page that does not change. Now within find the first table, then the first row, the first cell and the first . This page has some examples: https://seleniumjava.com/2017/12/07/find-child-elements-with-locator-chaining/

WebElement result = driver.findElement(By.id("an_id_that_doesnt_change"));
WebElement table = result.findElement(By.cssSelector("table"));
WebElement first_row = table .findElement(By.cssSelector("tr"));
WebElement first_cell = first_row .findElement(By.cssSelector("td"));
WebElement first_img = first_cell .findElement(By.cssSelector("img"));
first_img.click();



Source link https://sqa.stackexchange.com/questions/35232/how-to-click-on-the-image-inside-a--using--

LEAVE A REPLY

Please enter your comment!
Please enter your name here