Unable to click on a button/link on mobile view (iOS) via Appium using Capybara
My setup:
I'm testing a website on the mobile view (iOS). On Desktop it works fine (using Capybara), but when I test on mobile view (iOS) via Appium using Capybara the test gets stuck on a button, that is visible but Capybara is unable to click it.
The HTML:
<div id="HeaderContent" class="accordion-content" style="display: block;">
<div id="CompMessageContainer" class="content row hidden">
<div role="alert" aria-atomic="true" aria-relevant="all" aria-live="assertive">
<div class="uiMessaging alert-box radius success" id="ui-alert-message">
<div>
<div>
<div class="positiveCompMessageIcon"></div>
</div>
<div>
<div id="CartAlertMessage">
</div>
<ul id="cartAlertMessageDetails" class=" hidden">
</ul>
</div>
</div>
</div>
</div>
</div>
<div id="milAndFirstRespContent">
<div id="cartBottomAlternateDiscountOptions">
<div id="compText">
Random Text.
</div>
<div class="desktopComp-btn-container">
<a id="imgMil" href="#" class="login-trigger left utrack" data-scope="mil" data-track-event="CompTrigger">
<div class="desktopCompMilBtn"></div>
</a>
<a id="imgResp" href="#" class="login-trigger left utrack" data-scope="responder" data-track-event="CompTrigger">
<div class="desktopCompRespBtn"></div>
</a>
<div class="desktopCompLogo"></div>
<div id="desktopCompVerified" class="hidden">
<div class="desktopCompVerified"></div>
<div id="desktopCompStatus"> Status Verified</div>
</div>
</div>
<div>
</div>
</div>
</div>
</div>
My attempts to click the <div class="desktopCompMilBtn"></div>
button or a id="imgResp"
element.
pry(#<Object>)> find("div.desktopCompMilBtn").visible?
=> true
pry(#<Object>)> find("div.desktopComp-btn-container").visible?
=> true
pry(#<Object>)> find("div.desktopComp-btn-container").find("div.desktopCompMilBtn").visible?
=> true
pry(#<Object>)> find("div.desktopComp-btn-container").find("div.desktopCompMilBtn").click
=> nil
pry(#<Object>)> find("div.desktopComp-btn-container").find("a#imgMil").visible?
=> true
pry(#<Object>)> find("div.desktopComp-btn-container").find("a#imgMil").click
=> nil
pry(#<Object>)> find("div.desktopComp-btn-container").find("a#imgMil").find("div.desktopCompMilBtn").click
=> nil
Unfortunately nothing has worked thus far in being able to click the button. By the way the button is supposed to open up a new window, not sure if that matters or not.