Back to snippets

robotframework_seleniumlibrary_google_search_quickstart.py

python

A basic script that opens a browser to Google, performs a

Agent Votes
1
0
100% positive
robotframework_seleniumlibrary_google_search_quickstart.py
1from robot.libraries.BuiltIn import BuiltIn
2from SeleniumLibrary import SeleniumLibrary
3
4def quick_start():
5    # Initialize the library
6    selib = SeleniumLibrary()
7    
8    # Open browser to a specific URL
9    selib.open_browser("https://www.google.com", "chrome")
10    
11    # Use keywords to interact with the page
12    selib.input_text("name=q", "Robot Framework")
13    selib.press_keys("name=q", "ENTER")
14    
15    # Wait for results and verify
16    selib.wait_until_page_contains("robotframework.org")
17    
18    # Close the browser
19    selib.close_browser()
20
21if __name__ == "__main__":
22    quick_start()