Home > database >  Select parent div and not the child div in Robot Framework
Select parent div and not the child div in Robot Framework

Time:12-20

I am a newbie and I am developing a test automation in Robot Framework and it needs to select the parent div but the child div is the one that is always click.

this is my RF code:

Wait and click element          xpath: //div[contains(@class,'parent') and .='orange']

And this is the HTML

<div >
   orange
   <div ></div>
</div>

I want TA not to click the div.child. Is there any way to do this?

CodePudding user response:

try

Wait and click element          xpath://*[contains(text(),'orange')]

CodePudding user response:

Use Execute Javascript

Execute Javascript  $('.parent').click()

update your loctors based on your requirements.

  • Related