Selenium Webdriver for JavaScript - Add 'Sizzle' strategy -


i did poking around in selenium-webdriver source code, , found list of element locator strategies:

webdriver.locator.strategy = {   'classname': webdriver.locator.factory_('class name'),   'class name': webdriver.locator.factory_('class name'),   'css': webdriver.locator.factory_('css selector'),   'id': webdriver.locator.factory_('id'),   'js': webdriver.locator.factory_('js'),   'linktext': webdriver.locator.factory_('link text'),   'link text': webdriver.locator.factory_('link text'),   'name': webdriver.locator.factory_('name'),   'partiallinktext': webdriver.locator.factory_('partial link text'),   'partial link text': webdriver.locator.factory_('partial link text'),   'tagname': webdriver.locator.factory_('tag name'),   'tag name': webdriver.locator.factory_('tag name'),   'xpath': webdriver.locator.factory_('xpath') }; 

would possible extend sizzle selector engine?

someone did in java can't figure out how work javascript library.


when try

webdriver.locator.strategy.sizzle = webdriver.locator.factory_('sizzle'); 

i :

typeerror: cannot read property 'strategy' of undefined

so it's not trivial extend...

from own perspective, css2/css3 selector cover need.

because of bad default api, use un-friendly api driver.findelement(webdriver.by.css('input[name="textbox"]')). it's indeed bad without comprehensive document.

i suggest use https://npmjs.org/package/webdriver-helper friendly api support.

browser.element('input[name="textbox"]') , browser.link(':contains("partial link text")') you.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -