Watir-webdriver: how to change attribute value without js/jquery -


how can change href attribute value using watir-webdriver without using js/jquery?

i can attribute value:

@browser.frames[2].div(:id,"mid-2").link(:class,"btn-lrg").attribute_value("href") 

but need change bit of href attribute value.

i think way modify link use javascript. code quite maintainable since element retrieved using watir.

#get first link (or element want) element = browser.frame.link  #check element's initial attribute puts element.attribute_value('href') #=> "page_a.html"  #execute javascript change attribute script = "return arguments[0].href = 'page_b.html'" browser.execute_script(script, element)  #check attribute has changed puts element.attribute_value('href') #=> "page_b.html" 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -