目标异常:org.openqa.selenium.WebDriverException:拒绝访问属性的权限' M'

时间:2017-12-21 10:10:22

标签: selenium jmeter blazemeter

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

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

我已经使用了45版本的firefox becuase 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 

任何人都可以帮助我,因为昨天我正在努力解决这个问题。

1 个答案:

答案 0 :(得分:0)

您必须按照以下方式处理以下事项:

  • 当您使用较旧版本的 Firefox v45.x时,最好识别WebElements模仿 { {1}} 即可。因此,要找到 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