Below is HTML code,
<div role="alert" name="notification_actions" style="font-size:13px;" class="alert-action alert-info notify_actions text">
<a href="#"></a><a data-dismiss="alert" id="18" class="close remove_notify">×</a>
<div class="row share-notify">
<p>testuser has shared his profile with you.</p>
<div>
<a data-status="A" data-user_id="7" data-with_user="10" class="badge share-request" href="#">Accept</a>
<a class="badge share-request" data-status="D" data-user_id="7" data-with_user="10" href="#">Decline</a>
</div>
</div>
</div>
Code used:
waitForElementPresent
css=div[name="notification_actions"]
click xpath=.//*[@id='my-notification']/div/div/div/div/a1
Note: On Clicking the Accept button an Ajax call is working behind.
Update:
I am able to click on Accept button it is found behaving different.I have a verification after I click on this accept button that name of user should be displayed in left side bar under a menu. This flow is found not working only while I automate and no issue if done manually.
When executing
waitForElementPresent
command usingcss
Locator, the syntax is:Next use
link
Locator to click on 'Accept' or 'Decline' links.So in this case; when executing
waitForElementPresent
command usecss=div[name=notification_actions]
.When executing
click
command on 'Accept' or 'Decline' links, use:or