ruby - watir-webdriver: how to retrieve entire line from HTML for which I found substring in it? -


i've got in html coming server:

<html ...> <head ...> .... <link href="http://mydomain.com/digital_cameras--~all" rel="canonical" />  <link href="http://mydomain.com/digital_cameras--~all/sec_~product_list/sb_~1/pp_~2" rel="next" /> ... </head> <body> ... </body> </html> 

if b holds browser object navigated page need through, i'm able find rel="canonical" b.html.include? statement, how retrieve entire line substring found? , need next (not empty) one.

you can use css-locator (or xpath) link elements.

the following return html (which line) link element has rel attribute value of "canonical":

b.element(:css => 'link[rel="canonical"]').html #=> <link href="http://mydomain.com/digital_cameras--~all" rel="canonical" /> 

i not sure mean "i need next (not empty) one.". if mean want 1 rel attribute value of "next", can do:

b.element(:css => 'link[rel="next"]').html #=> <link href="http://mydomain.com/digital_cameras--~all/sec_~product_list/sb_~1/pp_~2" rel="next" /> 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -