PageObject with Ruby - set text in a text field only works in the main file

前端 未结 2 1431
面向向阳花
面向向阳花 2021-01-24 12:21

I\'m automating a site that has a page with a list of options selected by a radio button. When selecting one of the radios, a text field and a select list are presented.

2条回答
  •  面向向阳花
    2021-01-24 12:32

    I'm pretty new to this world of Selenium and page objects but maybe one of my very recent discoveries might help you.

    I found that that assignment methods for the select_list fields only worked for me once I started using "self" in front. This is what I have used to access it within my page object code. e.g., self.my_select_list="my select list value"

    Another note - The send_keys workaround you mention is clever and might do the trick for a number of uses, but in my case the select list values are variable and may have several options starting with the same letter.

    I hope something in here is useful to you.

    UPDATE (Jan 3/12)

    On diving further into the actual Ruby code for the page object I discovered that the select_list set is also using send_keys, so in actuality I still have the same limitation here as the one I noted using the send_keys workaround directly. sigh So much to learn, so little time!

提交回复
热议问题