How to find a variable with rspec tests using page.find

前端 未结 1 592
余生分开走
余生分开走 2021-01-16 16:34

I have a test case, most of my other pages have at least one field that is just straight text and can be found using:

page.find(\"tr\", text: \"What I filled         


        
相关标签:
1条回答
  • 2021-01-16 17:09

    If you want to click on the p element, you can easily do it with css selector or xpath:

    find(:css, 'the css selector of your p element').click
    

    or

    find(:xpath, 'the xpath of your p element').click
    

    For example

    find(:css, 'body > div.layout > div > button').click
    

    If you are using Chrome, you can easily find them by inspecting your element, right click on his code and copying the css selector or the xpath.

    0 讨论(0)
提交回复
热议问题