Python Selenium using onclick -


i using selenium in python , cannot find , select ok button. here code trying use not finding button.

submitelem = driver.find_element_by_name('ctl00$placeholdermain$ctl01$rptcontrols$btnok')  submitelem.submit() 

and webpage code

<input name="ctl00$placeholdermain$ctl01$rptcontrols$btnok"  value="ok"  onclick="javascript:webform_dopostbackwithoptions(new webform_postbackoptions(&quot;ctl00$placeholdermain$ctl01$rptcontrols$btnok&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))"       id="ctl00_placeholdermain_ctl01_rptcontrols_btnok" accesskey="o"    class="ms-buttonheightwidth" type="submit"> 

any advice on doing wrong? found suggestions add onclick*= did not seem work.

as noted earlier, if element in iframe, need switch contexts. additionally, if element takes time show on dom, due being dynamically rendered javascript, might need waits. want wait until element shows on page before performing actions on it.

from selenium docs:

element = webdriverwait(driver, 10).until(     ec.presence_of_element_located((by.id, "mydynamicelement")) ) 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -