Watir-webdriver: how to change attribute value without js/jquery
问题 How can I change a href attribute value using watir-webdriver without using js/jquery? I can get an attribute value: @browser.frames[2].div(:id,"mid-2").link(:class,"btn-lrg").attribute_value("href") But I also need to change a bit of the href attribute value. 回答1: I think that the only way to modify the link is to use javascript. The code is quite maintainable since the element is retrieved using watir. #Get the first link (or any element you want) element = browser.frame.link #Check element