Watir and text field inside iframe

前端 未结 4 1599
自闭症患者
自闭症患者 2021-01-22 10:26

I\'m trying to setup new text into a text field using Watir. The text field is placed inside iframe.

4条回答
  •  滥情空心
    2021-01-22 10:53

    @browser.text_field(:id => "IDUserId").set "TEXT"
    @browser.text_field(:name => "IDUserId").set "TEXT"
    @browser.text_field(:class => "sws_text_input").set "TEXT"
    

    Those will all work for a this text field as long as it is not contained in a frame, at which point you will need to identify it.

    You only want to use Xpath as a last result, as it is fragile and complicated. I'm not even sure if CSS works as I've never tried it.

    Please check out Željko's WATIR book or www.watir.com for basic locator methods.

提交回复
热议问题