My aim is to access js variable for a particular webpage and I want to print it in terminal/cmd for further process such as writing the Output into a file.
from selenium import webdriver
with open("list_links.txt","rb") as fs:
data = fs.readlines()
for line in data:
print "checking for: ",line
baseurl = line
driver = webdriver.Chrome()
driver.set_window_size(140, 800)
driver.get(baseurl)
driver.execute_script("alert(someVariable)")
where txt
file consists for different links and I am opening every page and popping an alert box which is giving me the output in the browser.
Everything is Working Fine, I just want to read/access the output which I am getting in the alert box.
SO, Is there any way to do this?
Also if there any way to read the same from console.log output text, please share.