我正在使用Robot Framework (RF)搜索与我的网站相关的关键字,以了解/找到我的网站在谷歌搜索页面中的排名位置(排名:第一,第二,...哪一页?第一页,第二页?)。
下面是我的代码:
*** Test Cases ***
Rank
Open Browser http://www.google.com.vn gc
Input Text name=q atdd framework
Submit Form xpath=//form[@action='/search']
Wait Until Element Is Visible xpath=//div[@class='srg']/li[@class='g']
${xpa-count}= Get Matching Xpath Count xpath=//div[@class='srg']/li[@class='g']
${lis}= Create List
: FOR ${i} IN RANGE 1 ${xpa-count} + 1 # XPath indexes are 1-based, but Python is 0-based
\ ${li}= Get Text xpath=//div[@class='srg']/li[@class='g'][${i}]
\ Append To List ${lis} ${li}
\ Log ${li}
Log List ${lis}
List Should Contain Value ${lis} robotframework.org/
${rank}= Get Index From List ${lis} robotframework.org/
${rank}= Evaluate unicode(${rank} + 1) # increment to get back to 1-based index
Log ${rank}
Log robotframework.org has rank ${rank}
[Teardown] Close All Browsers但在RF日志中的排名位置与Google屏幕不匹配:
Documentation:
Logs the length and contents of the `list` using given `level`.
Start / End / Elapsed: 20140509 10:25:51.025 / 20140509 10:25:51.026 / 00:00:00.001
10:25:51.026 INFO List length is 10 and it contains following items:
0: atdd-with-robot-framework - Google Code
code.google.com/p/atdd-with-robot-framework/ - Dịch trang này
This project is a demonstration on how to use Acceptance Test Driven Development (ATDD, a.k.a. Specification by Example) process with Robot Framework.
1: ATDDWithRobotFrameworkArticle - Google Code
code.google.com/.../robotframework/.../ATDDWithRobot...
Dịch trang này
21-11-2010 - Acceptance Test-Driven Development with Robot Framework article by Craig Larman ... See also ATDD With Robot Framework demo project.
2: tdd - ATDD versus BDD and the proper use of a framework ...
stackoverflow.com/.../atdd-versus-bdd-and-the-proper-us...
Dịch trang này
29-07-2010 - The Quick Answer. One very important point to bring up is that there are two flavors of Behavior Driven Development. The two flavors are xBehave ...
3: ATDD Using Robot Framework - SlideShare
www.slideshare.net/.../atdd-using-robot-framework
Dịch trang này
23-11-2011 - A brief introduction to Acceptance Test Driven Development and Robot Framework.
4: [PDF]
acceptance test-driven development with robot framework
wiki.robotframework.googlecode.com/.../ATDD_with_Ro...
Dịch trang này
WITH ROBOT FRAMEWORK by Craig Larman and Bas Vodde. Version 1.1. Acceptance test-driven development is an essential practice applied by suc-.
5: Robot Framework
robotframework.org/
Dịch trang này
Robot Framework is a generic test automation framework for acceptance testing and acceptance test-driven development (ATDD). It has easy-to-use tabular test ...
6: Robot Framework - Google Code
https://code.google.com/p/robotframework/
Dịch trang này
Robot Framework is a generic test automation framework for acceptance testing and acceptance test-driven development (ATDD). It has easy-to-use tabular test ...
7: Selenium 2 and Thucydides for ATDD | JavaWorld
www.javaworld.com/.../111018-thucydides-for-atdd.html
Dịch trang này
18-10-2011 - Find out how Thucydides extends and rethinks ATDD. ... In this article I introduce Thucydides, an open source ATDD framework built on top of ...
8: ATDD | Assert Selenium
assertselenium.com/category/atdd/
Dịch trang này
24-01-2013 - Thucydides In this article I introduce Thucydides, an open source ATDD framework built on top of Selenium 2. Introducing Thucydides ...
9: (ATDD) with Robot Framework - XP2011
xp2011.org/content.apthisId=180&contentId=179
Dịch trang này
Acceptance Test Driven Development (ATDD) with Robot Framework. Executable requirements neatly combine two important XP practices: user stories and ...请看一下第六位是Stackoverflow,但在Google上是第五位。
还有一个问题,如果我的网站在第一页不存在,如何扩展我的测试用例,然后我将在下一页搜索,然后获得页面ID?
谢谢。
发布于 2014-05-09 19:56:05
在测试和视觉检查时,页面上的结果可能不同。第一步是使用seleneium关键字来转储页面的Get Source。然后,您可以使用它来验证您的代码是否正常工作。
为了扩展您的测试用例,我将首先编写一个名为"get result“的关键字,该关键字返回结果和排名。我会写另一个关键字,名为“下一页”,这将转到下一页的结果。然后,我将编写另一个关键字"find page with result“,它在循环中调用"get result”。在循环体中,我会调用"get result“。如果未找到结果,则调用"Next page“并再次循环。最终,此关键字将找到包含结果的页面。
https://stackoverflow.com/questions/23556252
复制相似问题