Transcript for:
Playwright Introduction Lecture

hi everyone welcome you all  this is Pavan from SDA Channel   so from today we are going to  start a new series on playwright   and which is becoming very popular nowadays  in the market so just like selenium so the   playwright will also support multiple operating  systems multiple languages multiple browser   so let us see the introduction part like what  is playwright and what it will support and   finally we will also compare playwright with  selenium and then Cyprus now let's get started   so this is their official website of playwright  playwright.dev and in their website they   clearly mentioned playwright enables reliable  end-to-end testing for modern web applications   so through by using play Red we can automate uh  modern web applications and along with those web   applications we can also automate uh apis  and which will also support browser-based   applications in the mobile but it will not support  mobile native apps okay so this is the definition   they have given clearight enables a reliable  end-to-end testing for modern web applications   and which will also support multiple languages and  which is also having a community and they provided   lot of documentation very clear documentation and  based on that let us try to understand uh what   is play rate and what are the different features  which will support so the first thing is whenever   you are learning about the tool right first of all  we need to know what exactly which will support   so basically when you compare with applications  when you're talking from the applications   Prospect 2 so playwright support all kinds of  web applications and mobile web apps along with   the apis so applications prospective playwright  supports web browser applications or web based   applications and mobile web applications and then  apis so we can also test apis by using playwright   and when you come to the languages prospective  so just like a selenium favorite will also   support multiple languages like basically  which will support JavaScript and it will   also support typescript and also Java Python  and net so these are the programming languages   basically support by playwrite JavaScript  and typescript Java Python and dotnet   and a different kind of documents are also  available in their official website if you want to   use JavaScript there is a different documentation  is available for typescript Java python there   is separate documentation is available in their  official website if I look at this so initially   they started from node node.js that means which  will support JavaScript and if I just go here and   documentation docs and this is the documentation  clearly they have created from the basic like from   the installation everything how to write the  test how to run the test test generator and   so many features they clearly mention everything  in their documentation similarly if I select the   python so the same documentation is available  in the Python language and similarly Java so   all the documentation is clearly available in the  Java as well as dot net so these are the current   languages which will support it by playwright now  when you come to the browser support error so what   kind of browser switch will support so when you  come to the browsers almost it will support all   kinds of browsers like chromium-based browser  so there are different set of browsers which   are available in the market all are chromium based  so chromium based browsers will be supported along   with webkit especially for Safari browser for Mac  users and Firefox so all browsers uh headed mode   and headless mode both are supported by default  headless mode will be supported and if you want   to execute our test in the head mode headed mode  we can still exit out as cases in the headed mode   so when you come to the browser's supporting  chromium browsers will be supported so what   are the chromium browsers are available so let me  just go and fetch what are the browsers which are   supported chromium so if I just select like the  chromium or we can find list of chromium browsers   now you can see these are the different list of  chromium browsers like Opera epic Microsoft Edge   Brave Sim browser so these are all different  browsers which will use internally chromium   so even Google Chrome Right Touch these are all  chromium based web browsers so all these browsers   are supported by playwright and apart from this  which will also support Safari and especially   for Mac users and as well as Firefox and both  headed and headless mode will be supported   and now when you come to the operating system  support so which will support Windows Linux as   well as Mac so all kinds of operating systems  will be supported and along with the ca run   so we can also run our playwrite test on remote  environments and Jenkins or any other continuous   integration tools we can run so multiple languages  are supported multiple browsers are supported   multiple operating systems also supported now  when you come to the especially features what   are the main features are playing right so let me  list out what are the main features of player ID   so as we already discussed the playwright  is completely free and open source   free and open source what is a free means is  we no need to buy any license for it we can   simply install and we can start using the click  writer anybody can download and you can use it   and open source in a sense is a customized  so if you want to customize the tool you can   still customize you can add some more features  and you can contribute your time and effort   so that's called open source so free means  what we don't need to buy any license we can   simply install the tool download and install and  open source means we can customize the tool if I   want to add any third party libraries or if you  want to add any other features external features   you can still add them into a particular  tool so free and completely open source   and which will also support multi-browser multi  languages and multiple operating systems so these   are the main features because of this the tool  is becoming very popular even selenium is also   supporting multiple browsers multiple languages  multiple operating system same thing here   playwright is also supported multiple browsers as  we discussed earlier chromium Safari Firefox and   Etc and it will also support multiple languages  like JavaScript typescript Java Python c-sharp and   Etc and it will also support multiple operating  systems so this is another biggest feature from   Playmate and setup and configuration is very very  easy when you compare with the selenium and other   two setup and configuration is very very easy  apply right and what it will support what we   can do by using this playwright we can automate  functional test cases functional type of test   cases we can also automate apis and in addition  it will also additionally support accessibility   testing accessibility testing so but we can you  we have to use some third party plugins we have   to integrate with the playwright so that we  can also do accessibility testing along with   the functional and also accessibility testing a  functional and apis by default it will support but   if you want to do accessibility testing we have to  add some third party plugins with the playwright   and what else it will support So built-in reports  reporters are there suppose if you work with a   cilium or any other tools we need to rely on some  other third party libraries or third-party plugins   to generate the reports but here playwright is  our by default is having built-in reporters so   by using those built-in reporters we  can automatically generate our reports   and also if you want to generate any custom  reports we can still generate the custom reports   suppose this built-in reports you do not like  so then we can also generate some custom reports   and apart from this which will also support all CA  environment like Ci CD and Docker integration is   also supported and especially when you're talking  about web automation testing we'll always uh   need cross browser testing and parallel testing  so just like a selenium and Cyprus which will also   support parallel testing so parallel testing is  supported but in selenium so we have to depend on   test engine right but here we no need to depending  on any other third party libraries so play rate   by default support uh parallel testing and the  next important feature is what Auto weight this   is another important feature from collaborator so  what is the use of Auto weight especially when you   face any synchronization problems while automating  while executing your test cases on the browser   so to solve those synchronization problems so  normally we use a different type of weights   right if I are working on selenium so we have  to use something called implicit weight explicit   or grade weight right even Cyprus is also having  some building Auto weight mechanism so similarly   playwright is also having built-in Auto weight  mechanism but which is not there in selenium so we   no need to add any explicit weight statements in  script automatically clear rate will wait for the   elements wait for page loading in the different  scenarios so we don't need to add any additional   weights in playwright test cases and that is a  one more additional benefit from the playwright   which is also having built-in assertions  built-in assertions right so built-in   assertions means we need to uh use assertions  which is by default provided by playwright   okay and if you go with other tools like psyllium  so we have to use test engine assertions and if   you go with the Cyprus we use also smoke our chai  Library assertions similarly flavor it is also   provided some built-in assertions and by using  those accessions we can write all the validations   and because of that there are less likely tests  flaky test in the sense water sometimes when   you run your test cases it will execute and  pass sometimes it will not pass so you will   find most of the time sun stability while  executing your test cases so those type   of problems will automatically resolve  because of this reason in the playwright   okay and the next one is uh multi-tab and  multi Windows supporter this is another   most important feature from planet multi dab and  multi Windows supporter suppose if you are opening   any application right so when you click on some  link or when you click on some button which will   navigate to the another Tapper which will open  another application or another browser window   so in psylliums we have a different type  of switching commands so by using switching   commands we can just switch to another tab  or we can switch to another window browser   window then we can interact with the elements  or whatever operations we can do we can do it   all right here where we have to use insulin we  have to use something called switching commands   in the playwrite also multi-tab and multiple  window support is available but which is not   there in Cyprus so this is the additional feature  which is there in the frame rate and along with   this which will also support uh different kinds  of frames iframe support is also there and also   we can automate uh Shadow time elements  we can easily identify Shadow Dom elements   uh in playwright okay and uh which will also  support parameterization So when you're working   with the selenium so we have to use test engine  like data provider or we can pass parameters to   XML file but here this is also in the playwrite  also the parameterization concept is supported   and then we can also emulate mobile devices  so that means what whenever you do some kind   of mobile app testing like suppose if you  want to test some uh applications on the   mobile right normally you open the browser  and then you will bring your application URL   so to test those type of applications so emulate  we can also easily emulate mobile devices that   means whatever application you are testing on the  web or browser the same application we can easily   test on mobile browser so for that it will provide  some kind of emulation so because of that feature   we can easily achieve this and when you compare  with other tools playwright is very faster than   other tools so very very fast the execution will  be very faster when you compare with the selenium   and Cypress so these are the most important  features they have mentioned in their official   documentation so if I just go to their official  web page whatever features the playwright is   supported all the features they have mentioned  everything in their website so you can see any   browser any Platform One API like cross browser  class platform cross language and we can also   test mobile web so all the features are supported  and the reason a resilient no flag attachments   unstable unstability will be overcome so sometimes  we will execute the test cases sometimes it will   fail the same test cases again if you run it will  be failed so that is a basically uh the reason   behind that is we will integrate multiple tools  right so because of that unstable issues normally   we will we will see while executing our test cases  but that problem is automatically solved uh in   the play right because of built-in assessions  because Auto weight mechanism already there and   the web first assessions are assertions built-in  assessions are provided and raising uh facilities   there so because of this there are no flacky  tests flaky tests in the sense unstable test and   there are some more features they have provided in  their website so no trade-offs or No Limits Full   isolation fast execution and Powerful tooling so  it will also provided some tools called cold gen   code generator and playwright inspector traceview  or we can easily locate the elements so playwright   itself is provided a mechanism to inspect the  elements on the web that's called playwright   inspector today's viewer so we can easily see the  step-by-step execution how exactly the tests are   executed using traceviewer and code regenerator  and there are two methods we have in the play   rates we can automatically we can write our own  script for automating applications and we can also   automatically generate the code so that feature  is also available we can achieve this by using   Code gen so these are the different features they  have provided in playwright along with this they   have clear documentation whichever language you  are using with the playwright you can easily get   the documentation step by step documentation for  every language they provided like python node.js   java.net each and every step clearly they have  mentioned in the documentation it's more clear   and we can easily understand uh by reading this  documentation step by step okay this is a document   and Community Support they are having their  own GitHub repositories they are having their   own Community stack Overflow and YouTube channel  blogs and in their news they will provide all the   feeds so they're having their own community so we  can also join that community and we can post the   queries or we can ask some new features uh from  this particular tool we can suggest all the new   features in this particular tool so required  communities also maintain okay this is a basic   information about playwright so now we will just  compare leave it with the selenium and Cyprus   so what I'll do is let me share a small picture  yeah now feature based let us compare the tools   based on the different features so the first  feature is what browser supported so what are   the different browsers are supported so if I look  at the play rate as we discussed chromium webkit   which is Safari and Firefox will be supported and  then selenium will support Chrome Firefox offer   hi and Etc and Cyprus will support only Chrome  Firefox and Edge browsers and when you come to   the programming languages play rate support  Java python javascript.net which is c-sharp will also support multiple languages there are  Cyprus support only JavaScript and typescript   and operating systems when you come to the  operating system point of view which will support   only Windows Mac OS and Linux and similarly Cyprus  or selenium also support Windows Mac OS and Linux   and Cyprus also will support Windows  Mac OS and Linux so operating system   wise almost all the tools having same kind of  supporting now when you come to headless mode   we can execute tests in the Headless mode and  that is the default and the selenium also we can   execute in the Headless and even Cyprus also  we can execute tests in the Headless mode so   headless mode support is there on all three  tools and when you come to the Cross browser   testing also all the tools will support cross  browser testing means which will support multiple   browsers we can execute our test in multiple  browsers at the same time so that feature is   available in all the tools but in seleniums we  can achieve this cross browser testing is there   but if you want to execute or test in multiple  browsers again we need to take the help of test Ng   same thing parallel execution means what in  the playwright parallel execution is a built-in   feature which is there but in selenium so we  have to take the help of test NG then we can   achieve parallel execution and Cyprus will also  support parallel execution and when you come to   the auto weights and Cypress and the playwright so  these two tools are having built-in Auto weights   so we no need to use any explicit weights but  when you come to the selenium so we have to use   some different type of ways like implicit explicit  and plan twins so AutoVoice prospective there is   a difference and playwright and Cyprus by default  is having Auto edit it will automatically wait for   the elements and Page loading and so on suppose  when you're interacting with some element so   clever it is always automatically wait for that  element internally it will also have their own   built-in assertions right so because of that it  will wait for the element automatically and then   once the elements are available once the page is  loaded then further actions will be performed so   that is another good feature which is there in  the private and Cyprus and then multi-tab and   multi-window supported and multidab window support  in the playwright and selenium so in both the   tools we have this feature but uh in the Cyprus we  do not support multi-tab and multi window feature   and real-time test execution so real-time test  execution in the sense what on the runtime on the   real browser the test will be executed so only  in the Cyprus it is possible in the playwrite   Silicon when you launch your browser it will open  the browser and it will create their own profile   it will not live execution actually but when  you go to the Cyprus it will execute the test   on the browser at the runtime and playwright  selenium is having their own browser profile   and then execution will happen so real-time  test execution is Possible only in the Cyprus   and rest of the tools are not supported  now when you come to the debugging part   uh play rate is having built-in debuggers and also  we can use devtools integration for debugging the   code and when you come to the selenium integration  with the browser developer tool so psyllium is   basically when you want to debug the tool just  like uh Java debugging options we can use and   in the dev tools we can check exactly what are  the different apis or calling and uh when you   come to the Cyprus built-in debuggers and devtools  integration just like a playwright which is also   having built-in debuggers and also we can take  the help of devtools integration and the API   testing is supported in playwright and Cyprus but  not selenium so again we have to use some third   party libraries Java based libraries like HTTP  request or rest assured along with the Java and   then we can achieve it it can be Java or python  whatever so API testing directly not supported   but by integrating some third-party plugins we  can achieve API testing in silium but clearwright   Cypress by default support API testing and when  you come to the Community Support playwright and   Cyprus is growing Community barcelium is already  established community so because which was there   from since long time so there is large communities  help and documentation everything is available   for selenium but playwright and Cyprus uh he  being also growing community so now they are   also having communities but it's still growing it  it's not fully established just like a selenium   and when you come to the testing Frameworks  so playwright basically used with the popular   Frameworks like just mocha and Etc and uh selenium  so we have to again integrate some third party   rules like test engine Etc but when you come to  the Cyprus uh it is a mocha framework internal   it will use so we need to write all the tests in  the mocha framework which is a default style of   writing the test in the Cyprus but in play every  playwright which will support like just mocha also   which will support and they are inter built-in  Frameworks which by default support in playwright   and Cypress but if you want to implement any  framework in cm so we have to customize we have   to create our own framework like hybrid framework  or data driven or module or something like that   but when you come to the playwright in Cyprus  by default they will support they will provide   some kind of framework from mocha so all the  assertions and everything we can use from the   from their Frameworks and performance wise  obviously the playwright and Cyprus are very   faster than selenium so because in the selenium it  will internally use mediatory uh protocols right   it will not directly interact with the browser so  it will connect through browser-specific drivers   through w3c protocols it takes some time to  execute so obviously the performance will be   lesser than other so when you come to the  playwright and Cyprus it will directly   execute the code on the browser and directly  will interact so obviously the performance will   be faster than celium when you compare with the  sillium so playwright and Cyprus performance will   be faster okay so this is basically the comparison  so what exactly uh support and what exactly is not   supported so playwright slowly becoming popular  in the market because mainly these three reasons   which will support multiple operating systems  multiple browsers multiple languages just like   a syllium and moreover it is completely free and  open source tool so because of that reason uh   clear rate is becoming uh popular nowadays in the  market so you can just learn play right by using   any of the language you can use either JavaScript  or Java or python whatever she sharp or whatever   and uh most popular language is Javascript  so most of the companies are using play   rate with the JavaScript so the reason behind it  basically Java playeret is implemented on node.js   environment which will by default support  JavaScript so many people will use private   with the JavaScript just like a psyllium right  psyllium most of the people uh 70 Mark 70 of the   market capture is limited Java combination even  though it is supported other languages similarly most of the people most of the companies  are preferring to use playwright with the   JavaScript as a primary language and it is  better to learn JavaScript because most of   the people are already aware of python and Java  because they are there from since long time and   uh many people already know selenium so how to  write out automation test using selenium with the   Java as well as python so it is the right time to  learn some other language and the two JavaScript   and which will be used in many tools and most of  the probably in future most of the tools are also   may use JavaScript as a primary language so if  you already know Java and python so then better   to go with the JavaScript so from the next session  I'm going to start playwright with the JavaScript   because which is very popular when you compare  with the other languages okay so that's all for   this video so in the next video we will see the uh  installation part like how can we download how can   set up the environment and then how can we write  a basic test in the playwright and then we will   see some more topics so that's all for this video  thanks for watching we'll see in the next video