In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you an example analysis of jmeter and java_selenium automation. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
Jmeter can automate UI testing through WebDriver, or test browser-side pressure on the system, which requires the following jiar packages
Basic configuration
1: download JMeterPlugins-WebDriver-1.3.1.zip. After decompressing, copy all the jar files in the lib directory and the JMeterPlugins-WebDriver.jar files in the lib/ext directory to the lib directory and the lib/ext directory in the local Jmeter installation directory, respectively.
Download address https://jmeter-plugins.org/downloads/old/
2: enter the lib directory under the local Jmeter installation directory, delete the lower version of the httpclient, httpcore, and httpmime jar packages, and keep only the higher version.
3: start Jmeter, and you can see that several new Driver Config have been added to the configuration element in figure 3.38.
4: create a new Chrome Driver Config
5: after creating a new WebDriver Sampler, you can write some selenium scripts
The Selenium script parses try {var pkg = JavaImporter (org.openqa.selenium, org.openqa.selenium.support.ui) # # here is the class imported into support.ui, corresponding to selenium-support.jar WDS.log.info ('WDS Name:' + WDS.name) WDS.sampleResult.sampleStart () WDS.browser.navigate (). To ("https://qas.cttq.com")## calls the navigate method to jump to url The corresponding method WDS.log.info ('Browser Title:' + WDS.browser.getTitle ()) # # calls the getTitle method in selenium-remote-driver.jar to capture title The corresponding method is WDS.log.info ('Browser CurrentUrl:' + WDS.browser.getCurrentUrl ()) WDS.log.info (' Cookie:' + WDS.browser.manage (). GetCookies ()) WDS.log.info ('RequestHeader:' + WDS.sampleResult.getRequestHeaders ()) var what = WDS.browser.findElement (pkg.By.name ('username')) what.sendKeys ([' 8107000']) # # locate name elements in selenium-remote-driver.jar Trigger sendKeys event, fill in login name var where = WDS.browser.findElement (pkg.By.name ('password')) where.sendKeys ([' 000000']) # # locate name element, trigger sendKeys event, fill in login name var button = WDS.browser.findElement (pkg.By.id ('login-btn')) button.click () # # locate id element, trigger click event, click on several wrapper elements and events called above The corresponding method calls WebDriverWait in selenium-remote-driver.jar var wait = new pkg.WebDriverWait (WDS.browser, 5000) # #, and the corresponding method is in selenium-support.jar. The value is mswait.until (pkg.ExpectedConditions.presenceOfElementLocated (pkg.By.xpath ("/ html/body/div/header/div [1] / div/img")) # # call the previous wait 5s Force wait element to appear var results = WDS.browser.findElements (pkg.By.xpath ("/ html/body/div/header/div [1] / div/img")) WDS.log.info ('Result:' + results) if (results.empty) {WDS.sampleResult.successful = false WDS.sampleResult.responseMessage = "login failed"} else {WDS.log.info ("login")} # # assert whether the element has been successfully captured WDS.sampleResult.sampleEnd ()} catch (ex) {WDS.log.error (ex) WDS.sampleResult.successful = false WDS.sampleResult.responseMessage = 'There were no results returned' WDS.sampleResult.sampleEnd ()} editor introduces scripting language settings
Introduction to shortcut keys
FAQ method missing driver and browser version are not compatible the above is the example analysis of jmeter and java_selenium automation shared by Xiaobian. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.