I have been facing a problem for several days. Indeed I have several scenarios to test (Creation, edition, deletion) of an element in an array. The table contains this:
<iframe id="xFrame">
<div class="xddd" xpath="1">
<form id="xinputForm" name="xname" method="POST" action="#" class="ggg">
<table class="x-table border">
<tbody>
<tr>
<th class="X1" ></th>
<th class="X2" ></th>
<th class="X3" ></th>
<th class="X4" ></th>
</tr>
<tr value="{xvalueDynamic1}" id="{idDynamic1}" name="xName">
<td class="xell">
<label class="plm-custom-control mr-1"><input type="checkbox" id="chk" name="chk" value="{ValueDynamic}"><span></span></label>
<img src="./Images/Icons/ximgEmpty.gif" >
</td>
<td class="xell">
<a href="javascript:customMethod('{HrefDYnamic1}','0','Edit');">CS1</a>
</td>
<td class="xell">
Ceci est le premier CS</td>
<td class="xell" >
Sep 07, 2022
</td>
</tr>
<tr value="{xvalueDynamic1}" id="{idDynamic2}" name="SelectCS">
<td class="xell">
<label class="classLabel"><input type="checkbox" id="dc" name="dc" value="{ValueDynamic}"><span></span></label>
<img src="./Images/Icons/imgEx.gif">
</td>
<td class="xell">
<a href="javascript:customMethod('{HrefDYnamic2}','0','Edit');">dfdf</a>
</td>
<td class="xell">
dddddddddddddd
</td>
<td class="xell" ">
Sep 08, 2022
</td>
</tr>
</tbody></table>
</form>
</div>
</iframe>
I want to check an element in the array to do some actions (editing, deleting etc) after its creation from selenium. I have no problem creating the element. However, I can't locate the element in the array. The painting is in 2 frames. I can access the frames but not the element Here is the code:
public EditElementPage clickOnButtonEdit() throws InterruptedException {
Action.switchToFrameById(driver, "IdFrame1");
Action.switchToFrameById(driver, "IdFrame2");
String xpathText = "//td/a[contains(text(),'CS1')]/preceding-sibling::td/label/following-sibling::input[@id='chk']";
driver.findElement(By.xpath(xpathText)).click();
Action.scrollByVisibilityOfElement(driver, iconEdit);
//Action.fluentWait(iconEdit,10);
Action.click(driver, iconEdit);
Thread.sleep(2000);
Action.click(driver, buttonEdit);
return new EditElementPage ();
}`
Thank you for your help