Repository navigation
Update elementfinder.py to allow of use scLocator - #352
Conversation
Change contains new strategies scLocator and new method _find_by_sc_locator, solution is using build into smart client function isc.AutoTest.getElement
There was a problem hiding this comment.
A couple of questions. One, you use a double backslash "" when in all your references I see a double forward slash "//". For example, from here I see
//ListGrid[ID='filterGrid']
//DynamicForm[ID="autoTestForm"]/item[name=textField||title=textField||value=test||index=0||Class=TextItem]/element
and from codecentric
//DynamicForm[ID="doSearchForm"]/item[name=mainRegisterBox]/element
//Button[ID="searchPerson"]/
//ListGrid[ID="hitList"].0.0
Second, you also are replacing within the given locator what seems to be a leading single quote. That makes me assume that you are expecting the user to write a locator like these
scLocator='ListGrid[ID='filterGrid']'
scLocator='//ListGrid[ID='filterGrid']'
Again I am not familiar with SmartClient and SmartGWT but the general usage for locators within Selenium2Library has been without the quotes. For example
Good
----
id=my element id
id=this-element
Not-used
--------
id='quoted-string'
id='no used locator'
I know myself I forget this and added quotes ever once in a while. If there is a possibility of having a double space in the locator I can see the need to have the sytax support quoted locators. But again in general that is not how they are used elsewhere.
There was a problem hiding this comment.
I think they are just handling single quotation marks embedded in a string using single quotes as the start and termination characters so the JS statement is syntactically OK. jQuery selector is very similar and does the same thing. The double backslash is to escape the backslash which is a special char in Python.
Leaning toothpick syndrome!
Without replace (bad):
return isc.AutoTest.getElement('//ListGrid[ID='filterGrid']')
With replace (good):
return isc.AutoTest.getElement('//ListGrid[ID=\'filterGrid\']')
|
I am using currently provided solution and its using locators that could be found using selenium ide with extensions for SmartClient |
|
Ok, I read that wrong. You are un-escaping quotes, ', making them simply quotes, '. Just checking. Do you have any documentation you would like to have added so users will know how to use this locator? And possible any public facing websites that we can run sanity checks on the code base in case any changes occur near this? |
|
About documentation i would like to add new row in strategy table on Selenium2Library.html Here you can find showcase of smartclient but locators provided by SC are really long and its typical |
Update elementfinder.py to allow of use scLocator
|
Ok, I'll add some documentation within a separate pull request. |
Change contains new strategies scLocator and new method _find_by_sc_locator, solution is using build into smart client function isc.AutoTest.getElement