简体   繁体   English

如何使用 WebDriver 检索有关特定操作的 HTML 信息

[英]How to retrieve HTML information about specific actions using WebDriver

I'd like to reverse engineer Selenium WebDriver to write my tests for me as I use it.我想对 Selenium WebDriver 进行逆向工程,以便在我使用它时为我编写测试。 This would entail opening a WebDriver on screen, and clicking around and using it as normal.这将需要在屏幕上打开一个 WebDriver,然后像往常一样点击和使用它。 It will output instructions like self.driver.find_element_by_id('username-box') or whatnot for me, instead of the time-wasting of right-clicking the "Inspect element" each time I write a test.它将输出像self.driver.find_element_by_id('username-box')或诸如此类的指令,而不是每次编写测试时都浪费时间右键单击“检查元素”。

Ideally this will give me a nice xpath which is more exact.理想情况下,这会给我一个更好的 xpath,它更准确。 How do I retrieve the Xpath/way to recreate actions when manually using Selenium WebDriver?手动使用 Selenium WebDriver 时,如何检索重新创建操作的 Xpath/方式?

As Nameless said, it won't solve the "make me an efficient XPath", etc. problem that you are talking about but you can install Selenium IDE (a FF plugin) and record your scenarios and then export them into various languages.正如无名所说,它不会解决你所说的“让我成为一个高效的 XPath”等问题,但你可以安装 Selenium IDE(一个 FF 插件)并记录你的场景,然后将它们导出为各种语言。 It doesn't write the best code but you can get an idea of what it does with a quick download and install.它不会编写最好的代码,但您可以通过快速下载和安装了解它的作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在 WebServiceTemplate 中检索有关证书的信息? - How to retrieve information about certificate in WebServiceTemplate? 如何从微调器中检索特定的 object 信息 - How to retrieve specific object information from a spinner 使用datastax驱动程序检索有关Cassandra集群数据中心的信息 - Retrieve information about cassandra cluster datacenters using datastax driver 如何在AST eclipse中检索有关类的继承信息? - How can I retrieve inheritance information about a Class in AST eclipse? 给定WSDL,如何检索有关可用操作的信息? - Given a WSDL, how to retrieve the information about the available operations? 如何在Java中使用WebDriver执行多个关键动作 - How to execute multiple key actions using webdriver with java 如何使用 Selenium webdriver 打开特定浏览器 - How to open specific browser using Selenium webdriver 如何使用JDBC检索存储过程的信息? - How to retrieve the information of a sproc using JDBC? Java 8:使用Instant,如何检索ZoneId信息 - Java 8 : Using Instant, How to retrieve ZoneId information 如何使用Selenium Webdriver在带有查找功能的组合框中输入信息? - How to enter information in a combo box with look up using Selenium webdriver?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM