我有单击超链接的方案,并将打开新选项卡(单击超链接后活动窗口将移至新选项卡)
当我尝试使用switchTo()方法将WebDriver移至新选项卡时,随后WebDriverWait.until浏览器自动关闭并出现错误
org.openqa.selenium.WebDriverException: unknown error: cannot determine loading status
from no such execution context
(Session info: chrome=73.0.3683.103)
Run Code Online (Sandbox Code Playgroud)
我使用,System.out.println(driver.getWindowHandle())并且可以看到驱动程序移至新选项卡。
我如何解决以上错误?我尝试使用Iterator循环进入windowHandle
似乎无法使用WebDriverWait.until(ExpectedConditions)等待新选项卡。总是出错cannot determine loading status from no such execution context
奇怪的事情,我可以使用Thread.sleep(1000)。
在这种情况下,如何避免使用Thread.sleep?因为隐式等待也无法工作
使用Thread.sleep()的工作代码
public class MyCode {
private WebDriver driver;
private WebDriverWait wait;
@Test
public void openPrestaShopFromDemoWebsite() {
System.setProperty("webdriver.chrome.driver", "chromedriver");
ChromeOptions chromeOptions = new ChromeOptions()
.addArguments("--start-maximized", "--incognito");
driver = new ChromeDriver(chromeOptions);
driver.navigate().to("http://demo.prestashop.com");
wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.id("loadingMessage")));
driver.switchTo().frame("framelive");
String parentTab = driver.getWindowHandle(); …Run Code Online (Sandbox Code Playgroud) 我正在努力使用Java 8 DateTimeFormatter.
我想将给定的转换String为dateFormat并解析为LocalDateTime
这是我的代码
DateTimeFormatter f = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss")
String text = "2020-01-01T01:01:11.123Z"
LocalDateTime date = LocalDateTime.parse(text, f)
Run Code Online (Sandbox Code Playgroud)
但Java抛出
无法解析文本,在索引19处找到未解析的文本
如果我ofPattern改为yyyy-MM-dd'T'HH:mm:ss.SSSX,我的代码执行没有任何错误.但我不想使用毫秒和时区.
我有需要加载属性文件并将 prop 值分配给 JMeter UDV 的情况。
我已经能够成功加载属性文件,但是我无法将 prop 值分配给 UDV
我已尝试以下操作:
var_from_prop_file=1000)my.var”和值“ ${var_from_prop_file}”)使用调试采样器运行调试脚本,我可以看到var_from_prop_file分配给值1000
但是 my.var 仍然为空(没有值)。我在使用my.var = ${var_from_prop_file}, my.varvalue 创建 UDV 时的期望也会1000如此,但这里不会发生。
我已经尝试过__evaland _ _evalVar- 到目前为止还没有运气。
是否可以将 jmeter 变量引用到属性文件密钥?并在其他地方调用变量?
到目前为止,调试采样器 - 看起来像 jmeter 首先加载 UDV,然后加载 jmeter 属性,而不是反过来。