我在Python中使用Selenium和PhantomJS驱动程序。我收到了以下错误:
Message: {"errorMessage":"'undefined' is not a function (evaluating 'arguments[0].click()')","request":{"headers":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Length":"194","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:56304","User-Agent":"Python-urllib/3.5"},"httpVersion":"1.1","method":"POST","post":"{\"script\": \"arguments[0].click();\", \"args\": [{\"element-6066-11e4-a52e-4f735466cecf\": \":wdc:1489474684803\", \"ELEMENT\": \":wdc:1489474684803\"}], \"sessionId\": \"89d587e0-0883-11e7-9ebc-d3d9bf26e797\"}","url":"/execute","urlParsed":{"anchor":"","query":"","file":"execute","directory":"/","path":"/execute","relative":"/execute","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/execute","queryKey":{},"chunks":["execute"]},"urlOriginal":"/session/89d587e0-0883-11e7-9ebc-d3d9bf26e797/execute"}}
Screenshot: available via screen
我使用的代码是:
elem_more = wait.until(EC.element_to_be_clickable((By.LINK_TEXT, "Suivant")))
driver.execute_script("arguments[0].click();", elem_more)
相同的代码适用于Firefox驱动程序。