I am working to get the element details while clicking on that element inside the selenium web driver in python by executing a javascript function on the page.
But it is not working as I expected, even I have used the async method to get the element details from javascript to python. But I still can't able to get the element details in serverside python code.
Please provide a better solution for this case.
sample code
@asyncio.coroutine
def mouseevent(driver):
while true:
mouse =driver.execute_script('''
var x= onclick = function(e){
return e.target;
}
''')
print(mouse)
driver=webdriver.Chrome(Chrome)
driver.implicitly_wait(30)
driver.maximize_window()
driver.get("https://www.google.com/")
loop = asyncio.get_event_loop()
tasks = [
asyncio.ensure_future(mouseevent(driver))]
loop.run_until_complete(asyncio.wait(tasks))
loop.close()
Thanks in Advance.