- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我需要你的帮助来单击拆分按钮的右边缘(请参阅按钮和 Html 代码的链接)
在屏幕中我们有 2 个按钮,我想点击他右边缘的状态按钮(第二个按钮)。
问题+Html代码:
http://tinypic.com/r/2nbejvp/8
我试过下面的代码(没用)..
选项 1:
SeleniumApi.driver.findElement(By.xpth("//*[@id='ext-gen51']"));
or
SeleniumApi.driver.findElement(By.id("ext-gen51));
选项 2:
WebElement ele = SeleniumApi.driver.findElement(By.xpath("//*[@id='ext-gen51']"));
Actions build = new Actions(SeleniumApi.driver);
build.moveToElement(ele, (buttonwidth/2)+6, 0).click().build().perform();
选项 3:
WebElement first = SeleniumApi.driver.findElement(By.id("ext-gen51"));
first.sendKeys(Keys.PAGE_DOWN);
选项 4:
WebDriverWait wait = new WebDriverWait(SeleniumApi.driver,30);
By findBy = By.cssSelector("tbody.x-btn-icon-small-left td.x-btn-mr");
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(findBy));
element.click();
WebDriverWait wait = new WebDriverWait(SeleniumApi.driver,30);
By findBy = By.cssSelector("tbody.x-btn-icon-small-left em.x-btn-split");
WebElement element = wait.until(ExpectedConditions.elementToBeClickable(findBy));
element.click();
选项 5:
WebElement ele = SeleniumApi.driver.findElement(By.id("ext-gen51"));
ele.click();
Actions build = new Actions(SeleniumApi.driver);
build.moveToElement(ele, ele.getSize().getWidth()/2-5, 0).click().perform();
注意事项:
页面是用 extJS 框架生成的
我有 2 个拆分按钮,我想点击第二个。
最佳答案
第一个选项不起作用,findElement(By.id("//*[@id='ext-gen88']"))
,如您所见//*[@id='ext-gen88']
是一个 xpath
而不是 id
。当提供 id 时,您可能不必担心 xpath 或 cssSelectors,id 是访问任何元素的更好、更简单的方法。
所以下面的代码可以工作,
WebElement element = driver.findElement(By.id("ext-gen88"));
element.click();
或者您可以等待元素出现 explicit wait ,
WebElement element = new WebDriverWait(driver,30).until(ExpectedConditions.visibilityOfElementLocated(By.id("ext-gen88")));
element.click();
关于javascript - Selenium(网络驱动程序)- 无法单击拆分按钮的右边缘(请参见图片链接),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22011713/
第一个例子 text 第二个例子 text 最佳答案 第一个将内部 div 相对于它要定位的位置定位在顶部 10px 处。第二个将内部 div 顶部 10px 定位到它应该放置
我有一个在 Windows 上编译的 .exe 文件。但是当我从命令行运行它时,我没有看到我的程序输出到 std::cout 或 std::cerr 的任何东西。即使在命令行返回到提示后,该程序仍会运
网络摄像头不工作。它在控制台上显示“只允许安全来源”, 我访问服务器中的网络应用程序。我正在使用 192.168.1.11/myApp 访问我的系统。它在 chrome 中不起作用,但在 Firefo
我在将 jquery 对象呈现为 html 时遇到问题。 在下面的代码中,tickBox 被呈现为 [object Object] 而不是 html,而所有其余部分都被正确呈现。 我知道我可以将它作为
http://jsfiddle.net/r4KL9/ 这应该用相应的数据更改属性替换所有类。 如果我有: ...我希望它能返回 我的代码更改其中一个(按钮上的那个)但不更改另一个。 我做错了什么?
我正在尝试将重复规则打印为 iCalendar 格式指定的字符串(请参阅 RFC 5545)。我使用 python dateutils,特别是 dateutil.rrule 来创建重复规则,我想将其打
我正在尝试将重复规则打印为 iCalendar 格式指定的字符串(请参阅 RFC 5545)。我使用 python dateutils,特别是 dateutil.rrule 来创建重复规则,我想将其打
我收到消息了 _WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h) 来自每个 cpp 文件。 我尝
这里是窗口构建器新手,我第一次尝试为一个简单的程序创建一个 GUI。我想要显示一个表格和一些用户可以输入数据的插槽,然后按一个按钮并将它们添加到下面的表格中。你可以看一下GUI布局here 。 到目前
我正在尝试在 AWS EC2 实例上设置虚拟 v4l2 设备。我为 v4l2loopback-dkms 和 v4l2loopback-utils 安装了 apt。 当我尝试设置设备时出现以下错误 su
我正在开发一个 react - rails 应用程序,但我的控制台中一直出现此错误: ``` Warning: validateDOMNesting(...): cannot appear as a
我的服务器运行 openvpn 客户端,运行良好。但是在服务器重启后,我无法启动 openvpn 客户端。 openvpn 日志说: ERROR: Cannot open TUN/TAP dev /d
我正在尝试通过 Linux 服务器发送电子邮件,但我从未收到过。我目前正在使用腻子,我使用 # php -r 'mail("*****@gmail.com","Test subject", "Test
Bret Victor 几年前为响应式文档创建了一个名为 Tangle 的很酷的库。你可以在这里看到一个例子: http://worrydream.com/Tangle/TangleTemplate.
https://jsfiddle.net/0h3rqqru/ 我的问题是当有一个位置时出现奇怪的边界:绝对在一个位置内:相对边界半径:50%。 为此搜索了数小时的解决方案,但未能找到答
我正在尝试在 Akka 中使用 PersistentActor。 我尝试了 Akka 文档中提供的基本示例 https://doc.akka.io/docs/akka/current/persiste
我是 objective-c 中的新手,使用 iOS 9 Xcode 7.2 并收到此警告“'initWithRequest:delegate:'已弃用:在 iOS 9.0 中首次弃用 - 使用 NS
我试图 curl 到我的本地主机 laravel 站点。我正在使用 XAMPP 7.1 当我尝试重新连接此代码时,总是会出现错误(而不是 200 OK 响应) Fatal error: Uncaugh
当我导入 Gmail API 的 GTL.xcodeproj 并运行它时出现上述错误。我正在使用 Xcode 7.1 beta 并且在 Gmail API 二进制文件的头文件中出现了很多错误我们不推荐
我是一名优秀的程序员,十分优秀!