lundi 22 mai 2017

I want to convert given Xpath into CSS

I want to convert the //input[@id=(//label[text()='Search for:']/@for)] to Css selector in selenium

Following is the HTML

<td class="mstrSearchFieldSearchBox">
    <div title="" class="mstrTextBoxWithIcon" id="id_mstr56" style="display: block;">
        <div class="mstrTextBoxWithIconCaption">
            <label for="id_mstr56_txt">Search for:</label>
        </div>
        <table cellspacing="0" cellpadding="0" class="mstrTextBoxWithIconTable">
            <tbody>
                <tr>
                    <td class="mstrTextBoxWithIconCellInput">
                        <div>
                            <input maxlength="" onclick="if (mstr.utils.ISW3C) {this.focus();}" onkeypress="return mstr.behaviors.TextBoxWithIcon.onkeypress(arguments[0], self, 'id_mstr56', this.value)" name="id_mstr56_txt" style="background-color: rgb(255, 255, 255);" id="id_mstr56_txt" size="" type="text">
                        </div>
                    </td>
                    <td class="mstrTextBoxWithIconCellIcon">
                        <div class="mstrToolButtonRoundedRight" style="background-position: left center;">
                            <input type="button" title="Search" onmouseout="mstr.behaviors.ToolButtonRounded.unhover(this.parentNode)" style="background-position: left center; cursor: pointer;" class="mstrBGIcon_tbSearch" src="../images/1ptrans.gif" onmouseover="mstr.behaviors.ToolButtonRounded.hover(this.parentNode)" onclick="mstr.behaviors.TextBoxWithIcon.fire('id_mstr56', this.parentNode.parentNode.previousSibling.childNodes[0].childNodes[0].value);return false;">
                        </div>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</td>

Aucun commentaire:

Enregistrer un commentaire