简体   繁体   中英

Watir and Javascript button

How can I click a button in Watir that is defined like this:

<div id="divAddCompany" onclick="AddComp()">
<span>Add company</span>
</div>

and the JavaScript code looks like this:

    function AddComp() {
    HideComp();
    $(hide).css({ visibility: "visible", height: "auto" });
    var a = document.getElementById("divSave");
    a.onclick = InsertCompany;
}

I tried in Watir :

browser.text_field(:id, "Add company").click
browser.button(:name, "Add company").fire_event
browser.div(:name, /divAddCompany/).button(:value, "Add company").click

Any other suggestions? Thanks

它与:

browser.div(:id, "divAddCompany").click

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