简体   繁体   中英

looking for element always returns false in Watir-Classic

<div class="wizardPanel box cf" id="wizardPanel">
    <p class="validation-msg error visually-hidden" id="error0"><span data-icon="warn"></span>Your departure and arrival cites must be different. Please correct the highlighted fields below.</p>
    <p class="validation-msg error visually-hidden" id="error1"><span data-icon="warn"></span>The return date must be later than the departure date. Please select a different date.</p>
    <p class="validation-msg error visually-hidden" id="error2"><span data-icon="warn"></span>Sorry, we're able to book only 1 to 6 passengers total per itinerary.</p>
    <p class="validation-msg error visually-hidden" id="error3"><span data-icon="warn"></span>Please select the ages of the children traveling.</p>
    <p class="validation-msg error visually-hidden" id="error4"><span data-icon="warn"></span>We are only able to book one infant in lap per traveler aged 12+.</p>
    <p class="validation-msg error visually-hidden" id="error5"><span data-icon="warn"></span>Children must not be allowed to travel without either a Senior or Adult.</p>
    <p class="validation-msg error visually-hidden" id="error6"><span data-icon="warn"></span>Please check the date highlighted below. Date format should be mm/dd/yy.</p>
    <p class="validation-msg error visually-hidden" id="error7"><span data-icon="warn"></span>Departure airport field is empty. Please enter correct airport name.</p>
    <p class="validation-msg error visually-hidden" id="error8"><span data-icon="warn"></span>Arrival airport field is empty. Please enter correct airport name.</p>
</div>

In the above HTML markup, I am trying to find whether the text is visible to the user or not. For that I am using the following code which works well with Watir-webDriver, but not in Watir-Classic(always returns false ):

@browser.div(:id => 'wizardPanel').p(:id => 'error2')..present?

Can someone help me to make it work across the FireFox, IE, Chrome browsers?

尝试

@browser.div(:id => 'wizardPanel').p(:id => 'error2').visible?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM