Python selenium - Call python method from javascript

59 Views Asked by At

Is it possible to call a python method from javascript in selenium.

I am looking something like QWebChannel in PyQt5.

I found how can i run javascript from python. Example:

driver = webdriver.Chrome(executable_path="C:\\chromedriver.exe")
driver.implicitly_wait(0.5)
driver.get("https://www.tutorialspoint.com/tutor_connect/index.php")
# to scroll till page bottom
driver.execute_script("window.scrollTo(0,document.body.scrollHeight);")

But i am looking from the oposite: when a javascript event is fired or a javascript function is end then call a python method.

0

There are 0 best solutions below