【发布时间】:2020-10-08 05:58:32
【问题描述】:
我必须使用 JSR223 Sample for chrome 构建 JMeter 脚本,我想知道是否有一种方法可以在脚本中配置路径,这样我就不需要在 Jenkins 中托管驱动程序。 在 Selenium 自动化中,我每次都使用 webdriverManger 下载新的驱动程序https://www.toolsqa.com/selenium-webdriver/webdrivermanager/
JSR223 采样器:
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.support.ui.WebDriverWait;
**System.setProperty("webdriver.gecko.driver","/Users/geckodriver");**
FirefoxOptions options = new FirefoxOptions().setAcceptInsecureCerts(true);
WebDriver driver = new FirefoxDriver(options);
def wait = new WebDriverWait(driver, 20);
driver.get('https://google.com/');
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//input[@name='q']")));
【问题讨论】:
标签: performance jenkins selenium-webdriver jmeter-plugins webdriver-manager