我可以通过 Capybara 的内容找到一个元素(任何类型)吗?
理想情况下,我想编写这样的代码:
find('Copy from a paragraph') # finds the p element
find('Copy from a link') # finds a element
find('Copy from a button') # finds button element
Run Code Online (Sandbox Code Playgroud)
等等。
如果你知道元素的类型,你可以写:
find('p', text: 'text in paragraph')
find('a', text: 'text in link')
find('button', text: 'text in button')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6959 次 |
| 最近记录: |