我正在使用带有Javascript的Web驱动程序采样器作为实时浏览器模拟的脚本语言。在Chrome的情况下,一切正常。但是,在IE的情况下,Internet Explorer驱动程序配置无法正常工作。 IE浏览器单独启动,其他操作不会被触发。以下是我收到的日志。
2018-04-04 11:47:38,176 INFO o.a.j.e.StandardJMeterEngine: Running the test!
2018-04-04 11:47:38,179 INFO o.a.j.s.SampleEvent: List of sample_variables: []
2018-04-04 11:47:38,187 INFO o.a.j.g.u.JMeterMenuBar: setRunning(true, *local*)
2018-04-04 11:47:38,248 INFO o.a.j.e.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group
2018-04-04 11:47:38,249 INFO o.a.j.e.StandardJMeterEngine: Starting 1 threads for group Thread Group.
2018-04-04 11:47:38,250 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error
2018-04-04 11:47:38,250 INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=1 ramp-up=1 perThread=1000.0 delayedStart=false
2018-04-04 11:47:38,254 INFO o.a.j.t.ThreadGroup: Started thread group number 1
2018-04-04 11:47:38,255 INFO o.a.j.e.StandardJMeterEngine: All thread groups have been started
2018-04-04 11:47:38,272 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-1
2018-04-04 11:47:53,219 ERROR o.a.j.t.JMeterThread: Error calling threadStarted
org.openqa.selenium.WebDriverException: session null does not exist (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 8 milliseconds
Build info: version: '2.52.0', revision: '4c2593cfc3689a7fcd7be52549167e5ccc93ad28', time: '2016-02-11 11:22:43'
System info: host: 'ERD-L144', ip: '192.168.56.1', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_151'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{capabilities={proxy={proxyType=system}, acceptInsecureCerts=false, browserVersion=11, se:ieOptions={browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.usePerProcessProxy=false, ignoreZoomSetting=false, ie.fileUploadDialogTimeout=3000, nativeEvents=true, ie.ensureCleanSession=true, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, initialBrowserUrl=http://localhost:41813/, ignoreProtectedModeSettings=false}, timeouts={implicit=0, pageLoad=300000, script=30000}, browserName=internet explorer, pageLoadStrategy=normal, unhandledPromptBehavior=dismiss, platformName=windows, setWindowRect=true}, sessionId=515c1f34-cdf2-4abb-a141-1bd0c7c3f278, platform=ANY}]
Session ID: null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_151]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_151]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.8.0_151]
at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.8.0_151]
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206) ~[selenium-remote-driver-2.52.0.jar:?]
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) ~[selenium-remote-driver-2.52.0.jar:?]
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678) ~[selenium-remote-driver-2.52.0.jar:?]
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:701) ~[selenium-remote-driver-2.52.0.jar:?]
at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.maximize(RemoteWebDriver.java:948) ~[selenium-remote-driver-2.52.0.jar:?]
at com.googlecode.jmeter.plugins.webdriver.config.WebDriverConfig.getPreparedBrowser(WebDriverConfig.java:235) ~[jmeter-plugins-webdriver-2.3.jar:?]
at com.googlecode.jmeter.plugins.webdriver.config.WebDriverConfig.threadStarted(WebDriverConfig.java:220) ~[jmeter-plugins-webdriver-2.3.jar:?]
at org.apache.jmeter.threads.JMeterThread$ThreadListenerTraverser.addNode(JMeterThread.java:676) [ApacheJMeter_core.jar:4.0 r1823414]
at org.apache.jorphan.collections.HashTree.traverseInto(HashTree.java:994) [jorphan.jar:4.0 r1823414]
at org.apache.jorphan.collections.HashTree.traverse(HashTree.java:977) [jorphan.jar:4.0 r1823414]
at org.apache.jmeter.threads.JMeterThread.threadStarted(JMeterThread.java:644) [ApacheJMeter_core.jar:4.0 r1823414]
at org.apache.jmeter.threads.JMeterThread.initRun(JMeterThread.java:632) [ApacheJMeter_core.jar:4.0 r1823414]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:246) [ApacheJMeter_core.jar:4.0 r1823414]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_151]
2018-04-04 11:47:53,223 INFO o.a.j.s.FileServer: Stored: D:\Bala\Performance\CoE\CSVs\users.csv
2018-04-04 11:47:53,224 ERROR o.a.j.t.JMeterThread: Error while processing sampler: 'Login Page'.
java.lang.IllegalArgumentException: Browser has not been configured. Please ensure at least 1 WebDriverConfig is created for a ThreadGroup.
at com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler.sample(WebDriverSampler.java:62) ~[jmeter-plugins-webdriver-2.3.jar:?]
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:490) ~[ApacheJMeter_core.jar:4.0 r1823414]
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:416) [ApacheJMeter_core.jar:4.0 r1823414]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:250) [ApacheJMeter_core.jar:4.0 r1823414]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_151]
2018-04-04 11:47:53,225 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-1
2018-04-04 11:47:53,226 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-1
2018-04-04 11:47:53,226 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test
2018-04-04 11:47:53,226 INFO o.a.j.s.FileServer: Close: D:\Bala\Performance\CoE\CSVs\users.csv
2018-04-04 11:47:53,228 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, *local*)
取样器代码是:
var pkg = JavaImporter(org.openqa.selenium, org.openqa.selenium.support.ui, org.openqa.selenium.ie.InternetExplorerDriver)
var wait = new pkg.WebDriverWait(WDS.browser, 60)
var username = WDS.args[0]
var password = WDS.args[1]
WDS.log.info('username :' + username)
WDS.log.info('password :' + password)
//WDS.browser.manage().window().maximize()
java.lang.Thread.sleep(1000);
WDS.browser.get("http://gmail.com")
WDS.sampleResult.sampleStart()
WDS.sampleResult.setSampleLabel("Login Page")
while(true) {
var currentState = WDS.browser.executeScript("return document.readyState;").toString().equals("complete")
if(currentState) {
WDS.log.info('Login Page - Document loaded...')
break
} else {
WDS.log.info('Login Page - Document is still loading...')
}
}
while(true) {
var activeRequest = WDS.browser.executeScript("return window.$.active;").toString().equals("0")
if(activeRequest) {
WDS.log.info('Login Page - Loaded all request...')
break
} else {
WDS.log.info('Login Page - Still loading request...')
}
}
wait.until(pkg.ExpectedConditions.presenceOfElementLocated(pkg.By.id('loginDiv')))
WDS.browser.findElement(pkg.By.id('username')).sendKeys([username])
WDS.browser.findElement(pkg.By.id('password')).sendKeys([password])
WDS.sampleResult.sampleEnd()
java.lang.Thread.sleep(10000);
以下是我到目前为止所做的事情:
在所有级别设置相同的安全模式 - 启用保护模式和 所有级别的安全性都设置为“高”。
设置安全模式 - 在所有级别中禁用保护模式
在64位驱动程序的注册表中创建了DWORD - 没有启动 浏览器本身。
尝试使用32位驱动程序 - 然后启动浏览器 抛出异常。
请建议我解决这个问题的解决方案。
答案 0 :(得分:0)
我已经执行了提供的脚本,直到获得gmail并成功执行。
我的系统规格: - IE-11 Windows 7(64位)
我对这种行为没有确切的解释,因为我对jmeter + selenium的工作量较少。
答案 1 :(得分:0)