Skip to content
This repository has been archived by the owner on Sep 29, 2022. It is now read-only.

Robotframework library to capture network responses using selenium-wire

License

Notifications You must be signed in to change notification settings

adiralashiva8/robotframework-seleniumwire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

robotframework-seleniumwire

Wrapper of python selenium-wire to capture browser network using robotframework

PyPI version Downloads PRs Welcome Maintenance

Installation

To install robotframework-seleniumwire

$ pip install robotframework-seleniumwire==0.1.1

Keyword documentation link

Usage:

*** Settings ***
Library    SeleniumWireLibrary

*** Variables ***
&{options}
...    disable_encoding=${True}
...    enable_har=${True}
...    exclude_hosts=['google-analytics.com', 'cdn.sstatic.net']

@{scopes}    .*stackoverflow.*

*** Test Cases ***
Network Logs Check
   # launch selenium-wire chrome browser
   Open Browser    ${options}

   # set domains to be captured
   Set Request Scope    ${scopes}
   
   # navigate to stackoverflow questions page
   Go To    https://stackoverflow.com/questions

   # get and log all stackoverflow requests
   ${stack_requests}=    Get All Requests
   Log    ${stack_requests}

   ${questions_request}=    Get Request By Name    /questions    request
   Log    ${questions_request}

   # clear stack requests
   Clear Requests

   # enter some random text
   Wait Until Page Contains Element    name:q
   Input Text    name:q    Robotframework
   Sleep   3s

   # click on about
   Wait Until Element Is Visible    link text:About
   Click Element    link text:About

   Wait Until Page Contains Element    xpath://a[text()='Leadership']
   Wait For Request    /company

   ${about_requests}=    Get All Requests
   Log    ${about_requests}

   &{request}=    Get Request By Name    /company    request
   Log    ${request.Method}
   Log    ${request.Response}

   HAR Archive    ${EXECDIR}/stackoverflow.har

   [Teardown]    Close All Browsers

⭐ repo if you like it


About

Robotframework library to capture network responses using selenium-wire

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published