我必须拖动图像并将其放入CQ5组件中.图像和组件位于不同的帧中.
以下是无效的代码,因为destination当目标框架处于活动状态时无法找到webelement .
new Actions(driver).dragAndDrop(target, destination).perform();
我还尝试在动作之间切换帧:
Actions builder = new Actions(driver);
Actions action = builder.clickAndHold(target);
driver.switchTo().frame("newFrame"); //switching frames
builder.moveToElement(destination);
builder.release(destination);
builder.build();
action.perform();
Run Code Online (Sandbox Code Playgroud)
这也不起作用.然后,我尝试通过偏移移动图像
new Actions(driver).dragAndDropBy(target, x, y).perform(); // x and y
Run Code Online (Sandbox Code Playgroud)
这移动了图像,但组件没有捕获它,可能因为动作太快了.有没有办法可以做这样的拖拽?
提前致谢.
我试图通过将自定义firefox配置文件传递给DefaultSelenium构造函数来启动selenium服务器.它使用指定的URL打开浏览器.
DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*custom \"C:/Program Files/Mozilla Firefox/firefox.exe\"",ReadConFile.readcoFile("serverName"));
selenium.start();
Run Code Online (Sandbox Code Playgroud)
日志是
16:39:19.246 INFO - Allocated session 4eb63d37a4ba4d2fb4e351f8f59e3ea6 for https://<myURL>, launching...
Run Code Online (Sandbox Code Playgroud)
那就像那样,服务器无法启动.
但是,如果我不使用自定义配置文件,这可以正常工作.
DefaultSelenium selenium = new DefaultSelenium("localhost", 4444, "*chrome",ReadConFile.readcoFile("serverName"));
selenium.start();
Run Code Online (Sandbox Code Playgroud)
我需要启动自定义配置文件,因为我已经保存了https所需的一些站点证书.另外,我是从eclipse执行的.
我认为我的服务器未配置为启动自定义配置文件.请帮我解决一下这个.