Home | 简体中文 | 繁体中文 | 杂文 | 打赏(Donations) | Github | OSChina 博客 | 云社区 | 云栖社区 | Facebook | Linkedin | 知乎专栏 | 视频教程 | About

4.8. HTML Tags and Watir Methods

4.8.1. Collections of HTML Elements

			
If you have a page that looks like this:

<a href="http://google.com">google.com</a>
<a href="http://facebook.com">facebook.com</a>
You can get href attribute of all links with:

browser.links.each do |link|
  puts link.href
end
When you execute the code, output should be:

http://google.com/
http://facebook.com/