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
Post a Comment