1).我知道如何从我的问题访问beanshell中的java字段和对象使用beanshell中的java类字段.但是,实现起来并不是那么干净,因为我需要先在beanshell中设置java变量,然后才能使用它.但是,在Jmeter中,它提供了非常干净的方式在beanshell中使用map,就像在java中一样,但是JMeter开发了它的知道库(类),它有助于访问map的get/put方法.我想以类似的方式在beanshell中访问Map.
我已经检查了JMeter以获取更多信息,我想知道,我已经创建了用户定义变量temp和赋值错误,现在在BSF过程中我只写了一行vars.put('Name','temp Value')并且它已更新临时变量的值.所以,问题是我还没有创建JMeterVariables对象变量,但仍然beanhell允许更新map中的值而不设置你的答案中提到的任何值.我想知道这是如何工作的,需要更深入的信息.
2).我在java和beanshell中创建了自己的类我正在导入这个类,但Command not found: BSClass()下面给出的是整个代码
Java类
package test;
public class BSClass {
public void BSCMethod(){
System.out.println("I am from BSClass method BSCMethod");
}
}
Run Code Online (Sandbox Code Playgroud)
sample.bsh
import test.BSClass;
c=BSClass();
c.BSCMethod();
print("I am from BeanShell Script");
Run Code Online (Sandbox Code Playgroud)
调用sample.bsh文件java类
package test;
import java.io.FileNotFoundException;
import java.io.IOException;
import bsh.*;
public class DynamicVariable {
public static void main(String[] args) throws FileNotFoundException, IOException, EvalError {
new bsh.Interpreter().source("\\src\\test\\sample.bsh");
}
}
Run Code Online (Sandbox Code Playgroud)
注意:
我很感激您的意见
我正在使用带有 java 的 selenium webdriver 来编写脚本。但是,我们有几个字段在单击按钮后被禁用。我们需要找到这个字段是否处于只读模式。我用过isEnabled,isDisplayed但不工作,系统显示NoSuchElementFound预期。有没有办法处理这个?
我想使用Spring Boot开发示例REST API项目.我很困惑,什么应该是正确的做法,因为我们有包装多个选项,如war,jar等.
我要求我有外部库文件夹,它有多个jar和资源文件,将在REST API和前端使用(使用React).
由于动态变化,我希望将jar和资源保留为外部依赖项,我不想将它们包含在项目中.我已经尝试使用loader.path使用的示例项目jar工作正常但相同的方法不使用war文件.我使用Maven作为构建工具.
war或jar?libSpring Boot的外部文件夹 - 我找不到解决方案.我正在开发selenium自动化的框架,我一直坚持使用下拉列表来获取下拉选项的值.我有下拉选项,但现在我想要相同下拉列表的值.是否有可能在硒中获得它.
例如:
这是Html标签:
<select id="periodId" name="period" style="display: none;">
<option value="week1">1</option>
<option value="week2">2</option>
<option value="week3">3</option>
<option value="week4">4</option>
<option value="week5">5</option>
<option value="week16">6</option>
</select>
Run Code Online (Sandbox Code Playgroud)
现在在我开发的框架中,我将传递下拉选项'5',现在我想要下拉选项'5'的值.使用硒可以获得下拉选项'5'的'week5'值吗?
我想移动滑块左侧的滑块。但是,selenium webdriver 将其移动到右侧,但不会移动到左侧。我想将滑块移动到滑块总宽度的 25%。我在 java 1.8 和 selenium 2.44 中使用下面给出的代码。我已经尝试了使用向上、向下、向左、向右箭头键的所有选项,但仍然无法实现。
我将不胜感激您的投入。
package RandD;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.interactions.Action;
import org.openqa.selenium.interactions.Actions;
public class test{
static WebDriver driver;
public static void main(String[] args)
{
driver = new FirefoxDriver();
driver.get("http://jqueryui.com/slider/");
driver.switchTo().frame(0);
slider();
}
public static void slider(){
WebElement slider = driver.findElement(By.id("slider"));
int width=slider.getSize().getWidth();
Actions move = new Actions(driver);
org.openqa.selenium.interactions.Action action = move.dragAndDropBy(slider, ((width*25)/100), 0).build();
action.perform();
System.out.println("Slider moved");
}
}
Run Code Online (Sandbox Code Playgroud) java ×4
beanshell ×1
javascript ×1
maven-2 ×1
reactjs ×1
selenium ×1
selenium-rc ×1
spring-boot ×1
testng ×1