mardi 23 juin 2015

Impossible to find "select" element with selenium even though it is there in source

Can someone please tell me what is the selector I have to use to choose the select element below? (code below) I tried below thing but am not able to choose the select element.

I used ".input-box .cp-select-box select" as selector, but selenium returns element not found. I don't understand why!

I then tried "#billing:prefix" as selector, but selenium returns element not found. I don't understand why!

I then tried "select[name=billing[prefix]]" as selector, but selenium returns element not found. I don't understand why!

I then tried "select[title=Title]" as selector, but selenium returns element not found. I don't understand why!

I want to use this selector in this code to choose a value:-- $this->select($this->byCssSelector($selector for select))->selectOptionByValue("Mr");

<div class="input-box validation-error">
    <div class="cp-select-box">
        <select id="billing:prefix" name="billing[prefix]" title="Title" class="required-entry validation-failed" style="width: 323px; height: 38px;">
            <option value="Mr">Mr</option>
            <option value="Mrs">Mrs</option>
            <option value="Ms">Ms</option>
            <option value="Miss">Miss</option>
            <option value="Dr">Dr</option>
            <option value="Sir">Sir</option>
            <option value="Prof">Prof</option>
            <option value="" selected="selected"></option>
        </select><span class="default-text" style="width: 288px;"></span><div class="validation-advice" id="advice-required-entry-billing:prefix" style="">This is a required field.</div>
    </div>
</div>

Can someone please tell me what is going on?

Thanks a lot!

Aucun commentaire:

Enregistrer un commentaire