What I need to do here is to click an OK button in a pop up. That OK button is mentioned in the inspect menu as:
id="btn-confirm-yes"
. Used this id to access the element, tried to copy its xpath and access via that and tried to access it via the div class. Unfortunately, everything returned element not found. Its hard for me to see why.
#This is the python script used to access
element = driver.find_element_by_id("btn-confirm-yes")
if element.is_displayed():
print "Confirm button element is there"
driver.implicitly_wait(4) # seconds
element.send_keys(Keys.RETURN)
else:
print "Confirm button element not found"
/* Hierarchy from Inspect menu */
<div id="sing-out-confirm" class="reveal-modal small open" style="top: 100px; opacity: 1; visibility: visible; display: block;">
<h2 class="text-uppercase">ALL DEVICE SIGNOUT</h2>
<p>Click OK to confirm All Device Signout.</p>
<form id="sign-out-user-account-form" method="post" action="/portal-owner-web/user-account/sign-out-all-device">
<div class="button-bar">
<a class="button small close-reveal-modal mr5" href="#">Cancel</a>
<a class="button small reveal-modal-button mr5" href="#" id="btn-confirm-yes">OK</a>
</div>
</form>
</div
Need to access the element which is specified in the inspect window as:
class="button small reveal-modal-button mr5" href="#" id="btn-confirm-yes"
A nudge in the right direction would be very helpful!