Execute Javascript Command in Selenium to get data from a webpage -


    <h4>lotus</h4> 

what want grab lotus value h4 tag , in post got answer using javascript command follow:

document.getelementbyid('17285').getelementsbytagname('h4')[0].innerhtml; 

and worked fine.

what want use javascript in selenium.

i tried following code :

msgbox driver.executescript("javascript:document.getelementbyid('17285').getelementsbytagname('h4')[0].innerhtml;") 

but empty messagebox, know why.

thank !

your id in html(17171) dosen't match id in code(17285). try this:

msgbox driver.executescript("javascript:document.getelementbyid('17171').getelementsbytagname('h4')[0].innerhtml;") 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -