Robotframework 如何在Google页面中获得正确的排名搜索
我正在使用Robot Framework RF搜索与我的网站相关的关键字,以了解/找到我的网站在谷歌搜索页面中的排名位置排名:第一、第二,。。。哪一页?第一页,第二页 这是我的代码:Robotframework 如何在Google页面中获得正确的排名搜索,robotframework,Robotframework,我正在使用Robot Framework RF搜索与我的网站相关的关键字,以了解/找到我的网站在谷歌搜索页面中的排名位置排名:第一、第二,。。。哪一页?第一页,第二页 这是我的代码: *** Test Cases *** Rank Open Browser http://www.google.com.vn gc Input Text name=q atdd framework Submit Form xpa
*** 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的日志上的排名与谷歌屏幕不匹配:
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,但在谷歌上是第五位
还有一个问题,如果我的网站在第一页中不存在,如何扩展我的测试用例,然后我将在下一页搜索,然后获取页面ID
谢谢。测试和目视检查时,页面上的结果可能会有所不同。第一步是使用seleneium关键字转储页面的HTML。然后,您可以使用它来验证代码是否正常工作
为了扩展您的测试用例,我将首先编写一个名为get result的关键字,返回结果和排名。我会写另一个名为next page的关键字,它会转到结果的下一页。然后我将编写另一个名为findpage的关键字,其中result在循环中调用get result。在循环体中,我将调用get result。如果找不到结果,请调用下一页并再次循环。最终,该关键字将找到包含结果的页面 你说stackoverflow是第六名,但看看你的日志,我在第二项中只看到一个SO参考。你确定你向我们展示了与你的问题相匹配的正确数据吗?