2
Я пытаюсь выполнить яваскрипта функцию веб-страницы с помощью селена пакет питонаселеном execute_script дает ошибку
Я хотел нажать на значение строки
<tr bgcolor="#FFFFFF" style="cursor:hand"
onmouseover="onmouseoverTR(this)"
onmouseout="onmouseoutTR(this)"
onclick="clearwsInfo('2015011800017','2015011800017',this);"
ondblclick='doSelect("auditflowForm","2015011800017");'>
функция как
function clearwsInfo(tmpdjbh,tmpsgbh,obj)
{
//判断yesnot existentTR已被existent,如果yes就还原到原来的样式
if (obj !="" && obj !=null )
{
if(preTR!=""){
preTR.style.background='#FFFFFF';
}
obj.style.background='#c9e3ef';
preTR=obj;
}
var forms = "parent.document." + gFormName + ".";
parent.document.getElementById("tmpsgbh").value = tmpsgbh;
parent.document.getElementById("tmpdjbh").value = tmpdjbh;
loadDwr(tmpdjbh,tmpsgbh) ;
parent.document.wsList.location.href = "http://114.255.167.200:8092/cidasEN/extend/wsTreeAction.do?cs=1&sgbh="+ tmpsgbh;
}
Код, который я пробовал, является
iedriver = 'C:\Users\IEDriverServer.exe'
browser = webdriver.Ie(iedriver)
browser.get ('http://114.255.167.200:8092/cidasEN/extend/LookAuditflowListAction.do')
browser.execute_script("clearwsInfo('2015011800017','2015011800017',this)")
я получил ошибку
Traceback (most recent call last):
File "D:\surendra\Neon-WorkSpace\EvidenseData\selinum.py", line 25, in <module>
browser.execute_script("clearwsInfo ('2015011800017','2015011800017',this)")
File "C:\Python27\lib\site- packages\selenium\webdriver\remote\webdriver.py", line 465, in execute_script
'args': converted_args})['value']
File "C:\Python27\lib\site- packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site- packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: JavaScript error
как я могу выполнить функцию clearwsInfo
Я попытался тр = browser.find_element_by_xpath ('// HTML/тело/TABLE/тр') для иерархии – surendra
<тело bottomMargin = 0 LEFTMARGIN = 0 TopMargin = 0> \t
<тело bottomMargin = 0 LeftMargin = 0 TopMargin = 0> \t
Смежные вопросы