bbangert / lettuce_webdriver

Selenium webdriver for lettuce
MIT License
81 stars 32 forks source link

Fix find_button to find the exact match for the button #47

Open danni opened 10 years ago

danni commented 10 years ago

Including only normalising the space.

This also means we only make one XPath request.

danni commented 10 years ago

Was generally thinking of going through and cleaning up the XPath for all of the steps to reduce the number of round trips to Selenium required to use LWD.

npilon commented 9 years ago

I'm not convinced that generating complicated xpath like this is actually a win. It definitely improves performance, but I can barely read it.

danni commented 9 years ago

What would make it more readable?

npilon commented 9 years ago

Perhaps starting with '//button[normalize-space(text())="{value}"]'.format(value=value) and then using += '|stuff' to expand it? I think in this case I'd find that more readable than a generator expression and join.