Hello guys,
I would like to need your help on this scenairo and would be great help if anyone of you resolve this issue.
My application has a table and need to update td value in it(which i have highlighted in bold). The DOM looks like
<table class= "clasname">
<tbody>
<tr>
<td>update value here</td>
</tr>
</tbody>
</table>
i used normal sendkeys method in selenium but it doesnt works. I believe we can achieve this through javascriptexecutor. however am not sure how to update the value. Could anyone of you pitch in and resolve it. Appreciated your help on this
Instructor
Ashish Thakur Replied on 20/06/2019
You can send text to a textbox only.
As i can see in the html code highlighted above, you are trying to send text to a non textbox element. i.e. td tag
its a text box only. however the DOM looks like that. So if you update the value of td, the text will automatically entered in the textbox in GUI. Unforturnetely i cant share the screenshot as it is in Client machine. we cannot handle this via normal selenium methods. But we can handle this via javascript, unfortunately i dont possess rich knowledge on JS.
Also, if the td contains any attribute like id or class, it would have been easy to update the text. Since the td tag doesnt contain any attribute and we dont have any other option to pass the text other than using tagname. Could anyone please assisst me on this.
Instructor
Ashish Thakur Replied on 20/06/2019
You need to use send keys with input tag element only. Look for the element with input tag only.
there is no input tag exist in the DOM. it is td tag and am able to take xpath of it. if i trigger sendKeys agaisnt this, it is not entering text
Instructor
Ashish Thakur Replied on 24/06/2019
The sendKeys() work only with the <input> tag. You need to carefully look for the input element. It may be hidden inside the DOM structure.