Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modify innerHTML using Selenium

I have this element:

WebElement element = ...
string val = element.getAttribute("innerHTML");

All I want to do is to change this innerHTML on my web page.
Is it possible?

like image 839
david hol Avatar asked Mar 10 '16 16:03

david hol


1 Answers

in python use this :

element = driver.find_element_by_id("some_id")
driver.execute_script("arguments[0].innerText = 'what_you_want_to_show'", element)
like image 129
mamal Avatar answered Nov 16 '22 01:11

mamal