Using CSS ":contains:" with WebDriver in Python -


i'm migrating selenium webdriver test cases unittest py.test , seeing issue when attempt use *:contains() command on css selector. here's example of line fails:

    webdriverwait(driver, 60).until(         expected_conditions.element_to_be_clickable((by.css_selector, "body.yui-skin-sam div[id=navigation] ul[id=mainnav] li span:contains(home)"))     ) 

any time i've attempt command css selector not contain *:contains(), works fine. otherwise, either timeoutexception or invalidelementstateexception. i've tried using following instead:

expected_conditions.element_located_to_be_selected          "         .element_to_be_clickable          "         .element_to_be_selected          "         .presence_of_element_located          "         .text_to_be_present_in_element          "         .visibility_of_element_located 

i'm sure issue has more attempting use *:contains(). attempting use by.name, by.xpath, or other object name, works fine. here's i'm looking @ respect html source on page:

</div>     <div id="headerbox">         <div id="content">             <div id="header">                 <div id="left">                     <img src="/images/header_logo.png" />                 </div>                 <div id="right">                             <div id="text">                             <div id='active_conf'>  running... </div><br>                             profile unlocked. ( <a href="/auth/lock/">lock</a>                             | <a href="/auth/logout/">logout</a> )<br>                                 </div>                 </div>             </div>             <div id="navigation">                      <ul id="mainnav">                                 <li><a href="/"><span>home</span></a></li>                                 <li><a href="/datavalues/"><span>datavalues</span></a></li>                                 <li><a href="/devices/"><span>devices</span></a></li>                     </ul> 

does know of way can work? ahead of time!

i'll preface saying i'm not familiar python bindings selenium (i use java)... however, had same problem while back. able solve injecting sizzle.js onto dom aid element location. sizzle brings :contains() psuedo-class , support other jquery selectors well.

i able find small bit of info python here, i'm sure there's more thorough information out there.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -