pythonrobotframeworkselenium2library

How to verify value of first google search result using Robot Framework?


How can I do the following in Robot Framework: assert that first result of google search for 'stackoverflow.com' is stackoverflow.com website? Currently learning Robot framework, using Python and Selenium2Library.


Solution

  • you can use Should Be Equal As Strings keyword :

      Open Browser   https://www.google.com/  chrome
      Maximize Browser Window
      Wait Until Element Is Visible    xpath=//input[contains(@class,'gLFyf')]
      Input Text    xpath=//input[contains(@class,'gLFyf')]    stackoverflow.com
      Press Keys    xpath=//input[contains(@class,'gLFyf')]    ENTER  
      ${first_result}=    Get Text    xpath=(//*[contains(@class,'LC20lb ')])[1]
      Should Be Equal As Strings    ${first_result}     Stack Overflow - Where 
      Developers Learn, Share, & Build ...