python selenium
Published: 2024-06-10 06:59:42

                    1)Selenium Architecture

The architecture of Selenium is composed of :- 

1) Selenium IDE:
        a) IDE = Integrated Development Environment.
        b) It is nothing but a simple web-browser extension.
        c) You just need to download and install the extension for that 
         particular web browser.
        d) It can automate as well as record the entire automation 
             process.
        e) people generally prefer to write test-scripts using 
            Python, Java, JavaScript etc,
2) Selenium Remote Control:
            a) It has been deprecated. 
            b) It is not used these days.
            c) It it been replaced by Selenium WebDriver or better to 
               say the Python Selenium WebDriver Manager.
3) Selenium WebDriver:
           a) It is a major component of Selenium test suite
           b) It provides us an interface between the programming 
              language in which we write our test-scripts and the web- 
              browser itself.  
        c) It is composed of :-                                                         
                 i) Selenium Client Library:
                         1)They are language bindings/commands which 
                           you will use to write your automation 
                           scripts.
                
                        2)These commands are compatible with HTTP, TCP- 
                          IP protocols. 
                
                       3)They are nothing but wrappers which sent the 
                         commands to the network for execution into a 
                         web- browser.
ii) Selenium API:
            1)It is a set of rules and regulations which your Python 
              program uses to communicate with each other.
            2)It helps us in automation without the need for the user 
              to understand what is happening in the background.
iii) JSON Wire Protocol:-
             1)The commands that you write gets converted into JSON.
               which is then transmitted across the network or to your 
               web-browser so that it can be executed for automation 
               and testing.
             2)The JSON requests are sent to the client using the TCP- 
               IP/HTTP protocol.
iv) Browser Driver:
             1)It acts as a bridge between the Selenium script, 
               libraries and the web-browser.
             2)It helps us to run the Selenium test-scripts which 
               comprises Selenium commands on a particular web-browser.


4) Selenium Grid:-
           a)It is used to run parallel tests on multiple devices 
              running different browsers at different geographical 
              locations.
           b)We can run multiple test-cases simultaneously at one 
              moment of time.
           c)It uses the Hub-Node architecture or Master-Slave architecture.

                2)Python Virtual Environment

          a)It is a module which helps us to keep the required 
            dependencies of a particular project by creating 
            isolated environments for them.
          b)It is like Sandboxing your software.
          c)Install the virtual environment Python module “Globally”.

Installing Python Virtual Environment Module:
 
           pip install Virtual

Verify the Python Virtual Environment Module:

                  virtual  version.

Create a virtual Environment:
         a)It is created per project.
         b)It will create a folder for your project.

     virtualenu  < project _ folder _ name>
     cd < project_ folder _name>
     Scripts\activate
     Scripts\deactivate

NOTES : Just activate your Virtual Environment and start writing your Python codes.

PyCharm:
     pip install selenium
     pip install WebDriver-manager