How do I use python variable in a javascript?

后端 未结 4 1212
再見小時候
再見小時候 2020-12-30 13:28

I\'ve been on a prowl looking for a way to access a non visible text field using selenium\'s webdriver. The only way i got it to work is using

driver.execut         


        
4条回答
  •  别那么骄傲
    2020-12-30 13:37

    If I am understanding the problem correctly you are trying to pass a var instead of hard coded XYZ

    driver.execute_script("document.getElementById('text_field').value+='" + var + "'");
    

提交回复
热议问题