dzharii / swd-recorder

Selenium WebDriver Page Recorder (Page Objects)
MIT License
189 stars 71 forks source link

Added the current search context frame as field to WebElementDefinition,... #30

Closed ReneHabermann closed 9 years ago

ReneHabermann commented 9 years ago

... so that it can be accessed in templates.

Hi Dmytro, as you suggested in the google group, i submit this pull request (i was Horst there). Please check if you would be ok with this addition. Feel free to change anything ;)

I'll quote myself on this: "I started doing a modification myself and added the Frame to the WebElementDefinition class (i had to use a new class [SimpleFrame], because i ran into a cycle at serialization). When an element is created, i simply fill the frame with that one, that is selected in the tool as search context. This should work in general, because you can only detect elements in the frame that you have selected anyway. The reason i do this is because i need to access the frame in my template for code generation. I'm going for a class in my test code, that gets a locator and the containing frame (as string) - this way, the element will be able to switch into that frame automatically when an action is called, so that i can ignore the whole frame issue (i'll add a decorator that does the switching)."

This comes from project experience, where it is annoying to constantly switch between frames. I concluded it would be best, to let this be done by a WebElement Wrapper Class. I commited from this branch, because the master was not building for me with an indiscernable error saying only "the file contains damaged data".

Best Wishes, Rongo

dzharii commented 9 years ago

Hi @RongoMatane,

Thank you for your code contribution and notes! I have reviewed the code and merged it to the master.

Additionally, on the next weekend I will create the unit tests to be sure that my further changes will not brake your current templates.

Thank you, Dmytro

ReneHabermann commented 9 years ago

Thank you, i'm looking forward to integrate this tool for our projects. As i just started, we have no templates in use at the moment, so there is nothing to break ;) Best Wishes, Rongo