我的 webdriver 采样器代码如下:
var pkg = JavaImporter(org.openqa.selenium); //WebDriver classes
var support_ui = JavaImporter(org.openqa.selenium.support.ui.WebDriverWait); //WebDriver classes
WDS.sampleResult.sampleStart()
var wait = new support_ui.WebDriverWait(WDS.browser, 5000);
WDS.browser.manage().timeouts().implicitlyWait(25, TimeUnit.SECONDS);
WDS.browser.get('http://interview.erainfotechbd.com:5003/')
WDS.log.info("chat bot opended")
//var name= WDS.args[0]
//var number= WDS.args[1]
WDS.log.info("names are :" +WDS.args[0])
WDS.log.info("numbers are :" +WDS.args[1])
var wait=new support_ui.WebDriverWait(WDS.browser, 5)
WDS.browser.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
var userName = WDS.browser.findElement(pkg.By.xpath('//input[@name="nickname"]'))
userName.click(); //clicks search field
userName.sendKeys(WDS.args[0]) //types word "blazemeter" in field//saves search field into searchField
var mobileNumber = WDS.browser.findElement(pkg.By.xpath('//input[@name="mobile"]'))
mobileNumber.click(); //clicks search field
mobileNumber.sendKeys(WDS.args[1]) //types word "blazemeter" in field//saves search field into searchField
var loginButton = WDS.browser.findElement(pkg.By.xpath('//button[@id="Enter"]'))
loginButton.click(); //clicks login button
var wait=new support_ui.WebDriverWait(WDS.browser, 5)
var selectInterview= WDS.browser.findElement(pkg.By.xpath('//form[@id="myFormInt"]/input[1]'))
selectInterview.click()
var wait=new support_ui.WebDriverWait(WDS.browser, 20)
//timeouts.pageLoadTimeout(600, timeUnit.TimeUnit.SECONDS)
var returnedAnswer=WDS.browser.findElement(pkg.By.xpath('//input[@class="form-control"]')).getText()
var enterValidNumber= WDS.browser.findElement(pkg.By.xpath('//input[@class="form-control"]'))
enterValidNumber.sendKeys('01676912613')
var sendMessagebutton= WDS.browser.findElement(pkg.By.xpath('//button[@id="sendMessage"]'))
sendMessagebutton.click()
var wait=new support_ui.WebDriverWait(WDS.browser, 20)
//timeouts.pageLoadTimeout(600, timeUnit.TimeUnit.SECONDS)
WDS.vars.put('renderTime', renderTime.toString())
WDS.sampleResult.getLatency()
WDS.sampleResult.sampleEnd()
我已将我的主 jmeter 服务器配置如下:
server.rmi.ssl.disable=true
remote_hosts=127.0.0.1 , 10.11.200.203
运行我的脚本后,它给从机(10.11.200.203)以下异常
RemoteListenerWrapper: testStarted(host) on 10.11.200.203
java.rmi.ConnectException: Connection refused to host: 10.0.75.1; nested exception is:
java.net.ConnectException: Connection timed out: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source) ~[?:1.8.0_231]
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source) ~[?:1.8.0_231]
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source) ~[?:1.8.0_231]
at sun.rmi.server.UnicastRef.invoke(Unknown Source) ~[?:1.8.0_231]
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown Source) ~[?:1.8.0_231]
at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source) ~[?:1.8.0_231]
at com.sun.proxy.$Proxy21.testStarted(Unknown Source) ~[?:?]
at org.apache.jmeter.samplers.RemoteListenerWrapper.testStarted(RemoteListenerWrapper.java:79) [ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:208) [ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:381) [ApacheJMeter_core.jar:5.2.1]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_231]
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method) ~[?:1.8.0_231]
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) ~[?:1.8.0_231]
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[?:1.8.0_231]
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[?:1.8.0_231]
at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[?:1.8.0_231]
at java.net.PlainSocketImpl.connect(Unknown Source) ~[?:1.8.0_231]
at java.net.SocksSocketImpl.connect(Unknown Source) ~[?:1.8.0_231]
at java.net.Socket.connect(Unknown Source) ~[?:1.8.0_231]
at java.net.Socket.connect(Unknown Source) ~[?:1.8.0_231]
at java.net.Socket.<init>(Unknown Source) ~[?:1.8.0_231]
at java.net.Socket.<init>(Unknown Source) ~[?:1.8.0_231]
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source) ~[?:1.8.0_231]
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source) ~[?:1.8.0_231]
... 11 more
2020-02-09 09:31:37,277 ERROR o.a.j.s.RemoteListenerWrapper: testStarted(host) on 10.11.200.203
java.rmi.ConnectException: Connection refused to host: 10.0.75.1; nested exception is:
java.net.ConnectException: Connection timed out: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source) ~[?:1.8.0_231]
at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source) ~[?:1.8.0_231]
at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source) ~[?:1.8.0_231]
at sun.rmi.server.UnicastRef.invoke(Unknown Source) ~[?:1.8.0_231]
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown Source) ~[?:1.8.0_231]
at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source) ~[?:1.8.0_231]
at com.sun.proxy.$Proxy21.testStarted(Unknown Source) ~[?:?]
at org.apache.jmeter.samplers.RemoteListenerWrapper.testStarted(RemoteListenerWrapper.java:79) [ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfStart(StandardJMeterEngine.java:208) [ApacheJMeter_core.jar:5.2.1]
at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:381) [ApacheJMeter_core.jar:5.2.1]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_231]
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method) ~[?:1.8.0_231]
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) ~[?:1.8.0_231]
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[?:1.8.0_231]
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[?:1.8.0_231]
at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[?:1.8.0_231]
at java.net.PlainSocketImpl.connect(Unknown Source) ~[?:1.8.0_231]
at java.net.SocksSocketImpl.connect(Unknown Source) ~[?:1.8.0_231]
at java.net.Socket.connect(Unknown Source) ~[?:1.8.0_231]
at java.net.Socket.connect(Unknown Source) ~[?:1.8.0_231]
at java.net.Socket.<init>(Unknown Source) ~[?:1.8.0_231]
at java.net.Socket.<init>(Unknown Source) ~[?:1.8.0_231]
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source) ~[?:1.8.0_231]
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source) ~[?:1.8.0_231]
... 11 more
虽然它给出了这个例外,但经过一段时间 chromedriver open chorme 但它没有执行进一步的脚本,如浏览 url、登录等。
可能的原因是什么?