在Chrome和火狐上运行得很好,但IE11给出了以下脚本错误。
IE11 Script1003:预期为"}“请注意,我正在执行selenium中的脚本。driver.execute_script("console.log(document.title)"),你能告诉我如果我做错了该怎么办吗?
发布于 2020-04-20 23:12:14
尝试使用IE浏览器直接访问网站,并使用F12开发工具检查是否有相同的错误?
根据您的代码,我假设您正在使用python和IE webdriver,我已经使用以下代码创建了一个示例,该代码在IE11浏览器中运行良好。
import time
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
cap = DesiredCapabilities().INTERNETEXPLORER
cap['ignoreZoomSetting'] = True
driver = webdriver.Ie("D:\\Downloads\\webdriver\\IEDriverServer_x64_3.14.0\\IEDriverServer.exe",capabilities= cap)
driver.get("https://www.bing.com")
time.sleep(5)
driver.execute_script("document.getElementById('sb_form_q').value = 'Hi webdriver'; console.log('hello webdriver');")
print("*******************")请尝试测试上面的代码,如果仍然不能解决问题,请发布足够的代码来重现Minimal, Complete, and Verifiable example中的问题。
https://stackoverflow.com/questions/61322261
复制相似问题