I am trying to do a test for my site. Has problems in some kind of custom form. The trick is that the number of text fields in the form varies depending on the user's parameters (the code has disabled, but there is a style < displayed: none;> tag), so I'm trying to find a more flexible approach than finding each element one by one and filling out forms using blocks try / except.
I am using xpath locator
text_fields = driver.find_elements_by_xpath("//div[@class='form-line']/div[@class='form-inputs']/input[@type='text' and not(ancestor::div[@style='display: none;'])]")
The problem is that firebug finds only the needed elements, but when I use its selenium script, printing the list text_fieldsgives me all the elements, even without the < displayed: none;> tag
How can I get only visible items?
PS sorry for my bad english ^ _ ^
source
share