1

我正在运行我的这个脚本是 jmeter。它工作正常。但是我在blazemeter中执行相同的脚本,它给出了这个错误。

I am using Firefox version is 45. and `Permission denied to access property 'M'what it means,

我使用了 45 版本的 firefox,因为 jmeter 支持这个版本。所以我用过。

它给出的错误以下,

2017/12/21 09:43:48 ERROR - com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler: Sourced file: inline evaluation of: ``import org.apache.jmeter.services.FileServer; import org.openqa.selenium; import . . . '' : Method Invocation wait.until : at Line: 21 : in file: inline evaluation of: ``import org.apache.jmeter.services.FileServer; import org.openqa.selenium; import . . . '' : wait .until ( ExpectedConditions .visibilityOfElementLocated ( By .id ( "userEmail" ) ) ) 

Target exception: org.openqa.selenium.WebDriverException: Permission denied to access property 'M'

我的代码是,

import org.apache.jmeter.services.FileServer;
import org.openqa.selenium;
import org.openqa.selenium.firefox.FirefoxProfile;
import java.time.temporal.ChronoUnit;
import java.time.format.DateTimeFormatter;  
import java.time.LocalDateTime;   
import org.openqa.selenium.WebElement;
import org.openqa.selenium.By;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.FileWriter;
import java.util.concurrent.TimeUnit;
import java.util.ArrayList;
import java.util.List;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.support.ui.ExpectedConditions;
WebDriverWait wait= new WebDriverWait(WDS.browser,220);
WDS.sampleResult.sampleStart();
WDS.browser.get("https://app.mammoth.io/#/login");

wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("userEmail"))).sendKeys(new String[] {"deepak.merahkee@gmail.com"});
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("userPwd"))).sendKeys(new String[] {"*************"});

WDS.log.info("oasdfhdsf");

login=wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//button[@class='btn btn-mammoth']")));
start=LocalDateTime.now();
login.click();
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//section[@class='workspace ng-scope']")));

end=LocalDateTime.now();
Long minutesBetween=ChronoUnit.MILLIS.between(start,end);
String Timestamp = Long.toString(minutesBetween);

WDS.log.info("Login: login = "+Timestamp);
WDS.browser.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);  

WDS.sampleResult.sampleEnd();

它给出了这个错误,

2017/12/21 09:43:39 INFO - jmeter.util.JMeterUtils: Setting Locale to en_US 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Loading user properties from: /usr/sbin/apache-jmeter-3.1/bin/user.properties 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Loading system properties from: /usr/sbin/apache-jmeter-3.1/bin/system.properties 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Setting JMeter property: beanshell.server.file=/tmp/blazemeter.bsh 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Setting JMeter property: beanshell.server.port=53900 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Setting JMeter property: blazemeter.machine_ip=35.199.37.40 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Setting JMeter property: jmeter.save.saveservice.connect_time=true 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Setting JMeter property: jmeterengine.nongui.port=4455 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Setting JMeter property: sample_variables=in 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Setting JMeter property: InstanceID=0 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Setting JMeter property: EngineIndex=0 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Setting System property: file.encoding=UTF8 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Setting System property: user.dir=/home/jmeter 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Setting System property: sun.net.inetaddr.ttl=20 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Setting System property: networkaddress.cache.ttl=20 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Copyright (c) 1998-2016 The Apache Software Foundation 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Version 3.1 r1770033 
2017/12/21 09:43:40 INFO - jmeter.JMeter: java.version=1.8.0_141 
2017/12/21 09:43:40 INFO - jmeter.JMeter: java.vm.name=OpenJDK 64-Bit Server VM 
2017/12/21 09:43:40 INFO - jmeter.JMeter: os.name=Linux 
2017/12/21 09:43:40 INFO - jmeter.JMeter: os.arch=amd64 
2017/12/21 09:43:40 INFO - jmeter.JMeter: os.version=4.4.0-96-generic 
2017/12/21 09:43:40 INFO - jmeter.JMeter: file.encoding=UTF8 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Max memory =6934757376 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Available Processors =2 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Default Locale=English (United States) 
2017/12/21 09:43:40 INFO - jmeter.JMeter: JMeter Locale=English (United States) 
2017/12/21 09:43:40 INFO - jmeter.JMeter: JMeterHome=/usr/sbin/apache-jmeter-3.1 
2017/12/21 09:43:40 INFO - jmeter.JMeter: user.dir =/home/jmeter 
2017/12/21 09:43:40 INFO - jmeter.JMeter: PWD =/mnt/jmeter 
2017/12/21 09:43:40 INFO - jmeter.JMeter: IP: 10.240.0.14 Name: r-v3-5a3b82000f268-0-0-c FullName: r-v3-5a3b82000f268-0-0-c 
2017/12/21 09:43:40 INFO - jmeter.services.FileServer: Default base='/home/jmeter' 
2017/12/21 09:43:40 INFO - jmeter.services.FileServer: Set new base='/home/jmeter' 
2017/12/21 09:43:40 INFO - jmeter.save.SaveService: Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2 
2017/12/21 09:43:40 INFO - jmeter.save.SaveService: Using SaveService properties file encoding UTF-8 
2017/12/21 09:43:40 INFO - jmeter.save.SaveService: Using SaveService properties version 3.1 
2017/12/21 09:43:40 INFO - jmeter.save.SaveService: All converter versions present and correct 
2017/12/21 09:43:40 INFO - jmeter.save.SaveService: Loading file: FirefoxDriver.jmx 
2017/12/21 09:43:40 INFO - jmeter.samplers.SampleResult: Note: Sample TimeStamps are START times 
2017/12/21 09:43:40 INFO - jmeter.samplers.SampleResult: sampleresult.default.encoding is set to ISO-8859-1 
2017/12/21 09:43:40 INFO - jmeter.samplers.SampleResult: sampleresult.useNanoTime=true 
2017/12/21 09:43:40 INFO - jmeter.samplers.SampleResult: sampleresult.nanoThreadSleep=5000 
2017/12/21 09:43:40 INFO - jmeter.engine.StandardJMeterEngine: Running the test! 
2017/12/21 09:43:40 INFO - jmeter.samplers.SampleEvent: List of sample_variables: [in] 
2017/12/21 09:43:40 INFO - jmeter.samplers.SampleEvent: List of sample_variables: [in] 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Starting Beanshell server (53900,/tmp/blazemeter.bsh) 
2017/12/21 09:43:40 INFO - jmeter.engine.util.CompoundVariable: Note: Function class names must contain the string: '.functions.' 
2017/12/21 09:43:40 INFO - jmeter.engine.util.CompoundVariable: Note: Function class names must not contain the string: '.gui.' 
2017/12/21 09:43:40 INFO - jmeter.JMeter: Running test (1513849420724) 
2017/12/21 09:43:40 INFO - jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group 
2017/12/21 09:43:40 INFO - jmeter.engine.StandardJMeterEngine: Starting 1 threads for group Thread Group. 
2017/12/21 09:43:40 INFO - jmeter.engine.StandardJMeterEngine: Thread will continue on error 
2017/12/21 09:43:40 INFO - jmeter.threads.ThreadGroup: Starting thread group number 1 threads 1 ramp-up 0 perThread 0.0 delayedStart=false 
2017/12/21 09:43:40 INFO - jmeter.threads.ThreadGroup: Started thread group number 1 
2017/12/21 09:43:40 INFO - jmeter.engine.StandardJMeterEngine: All thread groups have been started 
2017/12/21 09:43:40 INFO - jmeter.threads.JMeterThread: Thread started: Thread Group 1-1 
2017/12/21 09:43:40 INFO - BlazeMeter: BlazeMeter startup script completed 
2017/12/21 09:43:48 ERROR - com.googlecode.jmeter.plugins.webdriver.sampler.WebDriverSampler: Sourced file: inline evaluation of: ``import org.apache.jmeter.services.FileServer; import org.openqa.selenium; import . . . '' : Method Invocation wait.until : at Line: 21 : in file: inline evaluation of: ``import org.apache.jmeter.services.FileServer; import org.openqa.selenium; import . . . '' : wait .until ( ExpectedConditions .visibilityOfElementLocated ( By .id ( "userEmail" ) ) ) 

Target exception: org.openqa.selenium.WebDriverException: Permission denied to access property 'M'
Command duration or timeout: 238 milliseconds
Build info: version: '2.52.0', revision: '4c2593cfc3689a7fcd7be52549167e5ccc93ad28', time: '2016-02-11 11:22:43'
System info: host: 'r-v3-5a3b82000f268-0-0-c', ip: '10.240.0.14', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-96-generic', java.version: '1.8.0_141'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true, databaseEnabled=true, version=28.0, platform=LINUX, browserConnectionEnabled=true, nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true, locationContextEnabled=true, browserName=firefox, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 453818df-7ba8-477b-a939-b26c13ab3a5e
*** Element info: {Using=id, value=userEmail}
in inline evaluation of: ``import org.apache.jmeter.services.FileServer; import org.openqa.selenium; import . . . '' at line number 21 
2017/12/21 09:43:48 INFO - jmeter.threads.JMeterThread: Thread is done: Thread Group 1-1 
2017/12/21 09:43:48 INFO - jmeter.threads.JMeterThread: Thread finished: Thread Group 1-1 
2017/12/21 09:43:48 INFO - jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test 
2017/12/21 09:43:57 INFO - jmeter.JMeter: Command: Shutdown received from /127.0.0.1 
2017/12/21 09:43:58 INFO - jmeter.JMeter: Command: StopTestNow received from /127.0.0.1 

谁能帮助我,从昨天开始我一直在努力解决这个问题。

4

1 回答 1

0

您必须注意以下几点:

  • 当您使用的是旧版本的Firefoxiev45.x时,最好识别WebElements模拟DOM. 因此,要找到该Email address字段,您可以使用以下代码行:

    wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//input[@class='form-control user-email ng-pristine ng-untouched ng-valid-email ng-invalid ng-invalid-required ng-valid-pattern' and @id='userEmail']"))).sendKeys(new String[] {"deepak.merahkee@gmail.com"});
    
  • 由于Email address字段和Password字段都在同一页面上,并且您已经等待Email address字段,因此您不必等待Password字段。所以你可以删除wait如下:

    WDS.browser.findElement(By.xpath("//input[@class='form-control user-pwd ng-pristine ng-untouched ng-invalid ng-invalid-required' and @id='userPwd']")).sendKeys(new String[] {"*************"});
    
于 2017-12-23T22:37:01.517 回答