_validate_page and lambda selectors

19 views
Skip to first unread message

joel.al...@gmail.com

unread,
May 13, 2014, 4:48:43 AM5/13/14
to wtfra...@googlegroups.com
hi,

In my PO i have lambda selectors like:
class SomePO:
someField = lambda self: self.webdriver.find_element_by_name("some_name")

How can i use that lambda selector in _validate_page(self, webdriver), since the webdriver is an argument and self.webdriver does not exists? Should i do self.webdriver = webdriver on the start of _validate_page?

Thanks,
Joel

David Lai

unread,
May 13, 2014, 5:32:34 PM5/13/14
to wtfra...@googlegroups.com
This is pretty hacky way, You might be able to get away with something like..

self.webdriver = webdriver

Then call self.someField().

I think I made a mistake in making it an instance method instead of a class method.  So that's why that trick might work.

Joel Alexandre

unread,
May 13, 2014, 5:36:04 PM5/13/14
to wtfra...@googlegroups.com
Yep, that's it. thanks.
Reply all
Reply to author
Forward
0 new messages