selenium遇到不可编辑input和隐藏input如何赋值

js = 'document.getElementsByName("m:csr_mt_gnccspjclfbxd:bmshldID")[0].type="text";'
browser.execute_script(js)
js='document.getElementsByName("m:csr_mt_gnccspjclfbxd:bmshldID")[0].setAttribute("class","");'
browser.execute_script(js)
browser.find_element_by_xpath("//input[@name='m:csr_mt_gnccspjclfbxd:bmshldID']").send_keys("10500032626")
js='document.getElementsByName("m:csr_mt_gnccspjclfbxd:bmshld")[0].removeAttribute("readOnly");'
browser.execute_script(js)

思路就是先改变属性,然后赋值

posted @ 2017-05-16 15:56  xqnq2007  阅读(3704)  评论(0编辑  收藏  举报