Watir-webdriver - Select a list display style: none

元气小坏坏 提交于 2019-12-04 18:03:45

Yes. The site I'm testing has a similar issue. This seems a new trend in site design, lately, since apparently select lists alone can't be made to look as fancy as unordered lists.

There is a tortured way to write procedural methods that interact with the dynamically generated HTML after you click on the thing that displays it, but it's pretty ugly code and I gave up using it in favor of the following code, which I've shortened for simplicity's sake:

@browser.execute_script(%{jQuery("select[#{attrib}|='#{value}']").show();})

This command exposes the actual select list in the UI, based on the target lists's tag attribute (like :id, :name, :title, etc.)

Once the select list is unhidden by that jQuery command then you can interact with it as normal.

Hopefully one of the Watir gurus will come up with a better solution, and soon, because I think this sort of page design is going to become more and more common going forward.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!