How To Execute Selenium Test on Docker Container

Sdílet
Vložit
  • čas přidán 21. 08. 2024
  • In this video, we will discuss How To Execute Selenium Test on Docker Container.
    Please refer previous videos for docker
    • What is Docker and How...

Komentáře • 118

  • @vaibhavpathak3041
    @vaibhavpathak3041 Před 5 lety +2

    You are one of those people who make difference in the society with the knowledge! Good job!

    • @Mukeshotwani
      @Mukeshotwani  Před 5 lety +1

      Hi Vailabhav thanks for you kind word. Many thanks to u as well for being active member on channel.

  • @ashwajitthukral9101
    @ashwajitthukral9101 Před 5 lety +3

    How easily you have explained this concept. Superb ! Could you please shed some light on kubernetes as well.
    Thanks a lot mate ✌️

  • @MadirajuKChaitanya
    @MadirajuKChaitanya Před 3 lety +2

    Excellent Tutorials, Mukesh Ji. Right on spot...!!. I followed your steps... as is... and the execution when smooth like a butter... Thank You :-).

    • @Mukeshotwani
      @Mukeshotwani  Před 3 lety +1

      Thank you so much Krishna ji, I am glad it worked for you.

  • @purushothamgowda6449
    @purushothamgowda6449 Před 3 lety +2

    Great video mukesh. This is informative and precise, i was able to run the code in docker container successfully. Thank you so much!

    • @Mukeshotwani
      @Mukeshotwani  Před 3 lety +1

      great Purushotham 👍 and thank you 😊

  • @kushanchoudhury1942
    @kushanchoudhury1942 Před 4 lety +2

    Docker has made life so simple...amazing Mukesh ..please share some more tutorials !!

    • @Mukeshotwani
      @Mukeshotwani  Před 4 lety

      Yes Kushan it really solved many QA and Developer issues. Sure I will try to make more videos on Docker , in the meanwhile check Zelenium as well which works on Docker with Kubernates

  • @AbhishekMishra-ru2fi
    @AbhishekMishra-ru2fi Před 5 lety +2

    You are on 🔥. Lot of thanks man.

  • @davidvasanthraj
    @davidvasanthraj Před 5 lety +2

    Thank you Mukesh, For posting such a good video,
    I have a questing that Since Docker is similar to platform as service, can we have a container with WindowsOS from MAC machine ?

  • @sssaamm29988
    @sssaamm29988 Před 3 lety +1

    Hi mukesh, thanks for the video.it was a good learning to me. I have a question, how can be run selenium tests in parallel mode of same browser? for example I have 10 testcases, that needs to run parallelly in 5 different containers in chrome browser?

  • @MamunKhan-kk2cf
    @MamunKhan-kk2cf Před 3 lety +1

    Thanks Mukesh, really helpful.

  • @kidsfun4448
    @kidsfun4448 Před 5 lety +1

    Thanks mukesh for this video..what are the advantage of running selenium test on container and do companies will switch to docker for testing

    • @Mukeshotwani
      @Mukeshotwani  Před 5 lety

      HI Priti, docker will platform for execution. Instead of running VM many companies prefer running on Docker.
      You can scale up and down depends on execution.

  • @AbhishekMishra-ru2fi
    @AbhishekMishra-ru2fi Před 5 lety +1

    Super....learnt it.We have more topics in docker ...plz upload it those as well...

    • @Mukeshotwani
      @Mukeshotwani  Před 5 lety +2

      Yes Abhi, Next video in on Zelenium (Docker with Kubernates)

    • @AbhishekMishra-ru2fi
      @AbhishekMishra-ru2fi Před 5 lety

      @@Mukeshotwani how can we create our own images and containers?

  • @prashantht.v8289
    @prashantht.v8289 Před 4 lety +2

    Hi Mukesh, Have a question here. After we execute our selenium tests in docker containers, How do we kill the nodes inside the Grid Console

    • @Mukeshotwani
      @Mukeshotwani  Před 4 lety

      Hi Prashanth, By default node will be present inside docker container, if you wish to delete docker container then you can delete the running container.

  • @PankajSharma-pl3nq
    @PankajSharma-pl3nq Před 5 lety +1

    Hi Mukesh, Thanks for the video.
    Docker is a vast subject in itself. From testing perspective what all is required?
    Is it just running he test on containers instead of VM's or Grid? Or do we have something more in pocket?
    2nd question- This set-up is also achievable in local system by having both chrome and Firefox browsers installed and running the test in parallel. What additional are we achieving with this method?
    Waiting for the doubts to be cleared. :-)

    • @Mukeshotwani
      @Mukeshotwani  Před 5 lety +1

      HI Pankaj,
      I am glad that you asked this question.
      1- Docker will provide you infrastructure so when you have to run test on VM which can handle 10 execution or 50 sessions. Lets assume you need to run 1000 test then you need another VM or VDI machine right, so instead for creating 10 VM you can use containers which are 50 times lightweighted as compared to VM's.
      please check my first video on Docker where I discussed the difference between VM and Container.
      last but not the least if you have less number of test and one VM is enough to run your test then you can VM or docker.

    • @PankajSharma-pl3nq
      @PankajSharma-pl3nq Před 5 lety +1

      @@Mukeshotwani Thanks a lot Mukesh for responding.
      I believe with docker we can save the infrastructure cost as well.
      If we need our tests to run on different OS and different browsers than the VM's must have those OS and browser installed. However with docker we can setup infrastructure by pulling the required OS and browser image files.

    • @Mukeshotwani
      @Mukeshotwani  Před 5 lety

      @@PankajSharma-pl3nq yes definitely it will save cost

  • @manishkannamoney7455
    @manishkannamoney7455 Před 3 měsíci

    Awsome Explanation! Can you suggest How to run CucumberBDD framework using Docker with headless?

  • @vasistatiruveedi690
    @vasistatiruveedi690 Před 4 lety +1

    Hi Mukesh, Thanks for the video

  • @akshaykarkare4851
    @akshaykarkare4851 Před 2 lety

    Hi Mukesh,
    Thanks for explaining docker so well.
    I need to know, how do you run automation suite on ECS cluster ?

  • @dipakagarwal1538
    @dipakagarwal1538 Před 5 lety +1

    Great Video

  • @tejkumarkempaiah6380
    @tejkumarkempaiah6380 Před 4 lety +2

    Thanks for the video Mukesh, But the relationship setting command for a hub and different nodes(like chrome, Firefox) are missing. Can you please info on them ?

    • @tejkumarkempaiah6380
      @tejkumarkempaiah6380 Před 4 lety +1

      Basically, We need to run the hub, the respective nodes (firefox, chrome) that's being missed out in the video as the port number usage is also critical. Requesting info on this.

    • @Mukeshotwani
      @Mukeshotwani  Před 4 lety

      Sure Tej let me check if I can add new video on this. Did you also check Zalenium, auto scaling containers czcams.com/video/PEjUCkNft7s/video.html

  • @deepanair1031
    @deepanair1031 Před 3 lety +1

    Hi Mukesh
    Thank you so much .awesome video😊. Could you please explain how to get the extend report on our local machine after the test execution on docker container

    • @Mukeshotwani
      @Mukeshotwani  Před 3 lety

      Hi Deepa by default reports will be in same machine from where you have executed the test.
      If you are have scripts in local machine but u r using Docker for only execution then reports will be in same machine.

    • @deepanair1031
      @deepanair1031 Před 3 lety +1

      @@Mukeshotwani thanks Mukesh. I will check and see why it is not being generated. Thanks for your response 👍

    • @deepanair1031
      @deepanair1031 Před 3 lety

      My bad , I forgot to call the rep.flush() function 😅

    • @deepanair1031
      @deepanair1031 Před 3 lety

      Hi Mukesh
      When I try to open our application url in docker container, it is giving the error message "your connection is not private ".Same in Firefox too. But the url is working fine on my local machine. Do you know how to fix this?

  • @ramanrayat
    @ramanrayat Před 4 lety +2

    Create some more tutorials on docker with selenium ...

  • @vrushali69
    @vrushali69 Před 3 lety +1

    Hi Mukesh
    Thanks for Ur videos..
    To run selenium test on docker is it complousry to up grid

    • @Mukeshotwani
      @Mukeshotwani  Před 3 lety +1

      Hi Vrushali, yes Grid is used whenever you have to run test in VM/Docker/Cloud or any other machine.

    • @vrushali69
      @vrushali69 Před 3 lety

      I still have one more doubt... M using maven -chrome image from docker .. i can c my code is able to produce output which I provided in sysout however I wanted to open chromedriver for that I also used webdrivermanagager.. so my question is in this grid will be up automaticall

  • @RajuDas-zn3gx
    @RajuDas-zn3gx Před 3 lety +2

    Hello Mukesh, thanks for the video and I could able to run successfully in docker. I have question regarding selenium/base. How we can run selenium test in this docker as it does not have chrome or firefox installed. Can you please explain this?

    • @Mukeshotwani
      @Mukeshotwani  Před 3 lety

      Hey Raju, docker image which we are using it creates container with browser installed (depends on which image you have used).

    • @RajuDas-zn3gx
      @RajuDas-zn3gx Před 3 lety

      @@Mukeshotwani I think my question was not clear. There is a image available selenium/base where browser is not pre install. In this container how to execute selenium script?

  • @suryaguntur2342
    @suryaguntur2342 Před 4 lety +1

    Hi Mukesh, Is this using Selenium webdriver 4 alpha? The other question I have is whether do I need to setup selenium grid locally on my machine? Any help in this regard is really appreciated.

  • @PankajSharma-pl3nq
    @PankajSharma-pl3nq Před 5 lety +1

    Mukesh, you have set the browser as Firefox and Chrome with the help of capabilities. I noticed that you were using Mac platform while you created the hub and node over docker.
    If we also want to set the platform like cap.setPlatform(Platform.WINDOWS)...will your code throw error?
    How can we have different platforms inside different containers the way we have created different browsers?
    Does our local operating system have any role in creation of container?

    • @Mukeshotwani
      @Mukeshotwani  Před 5 lety

      Hi Pankaj as of now container are linux containers so when u don't mention platform if takes default and run linux containers.
      You can connect your windows system as node to hub then when u mention platform windows then it will run on mode which is type of windows

    • @PankajSharma-pl3nq
      @PankajSharma-pl3nq Před 5 lety +1

      @@Mukeshotwani Thanks for replying.
      Somehow i am getting confused in this concept. Please bear with me for following last set of queries.
      1) How did you manage to create the Linux containers when you local system was having MAC operating system?
      2) Are all the containers by default created on linux platform?
      3) You mentioned that i can connect windows system as node to hub. Are you referring to traditional method of Selenium Grid concept?
      4) Is it possible to create Windows or MAC Containers and run selenium nodes on them?
      Thank you in advance. :)

    • @Mukeshotwani
      @Mukeshotwani  Před 5 lety +1

      As of now All containers are linux containers.
      Windows container are possible but it will take some time because it is in beta phase.
      As of now if u need any other machines apart from linux then traditional way u have to connect with hub and then use the same.

  • @devikabraj731
    @devikabraj731 Před 3 lety +1

    Hi Is it possible to run selenium webdriver rather than selenium grid inside a docker container...

  • @deoshaw4682
    @deoshaw4682 Před 3 lety +1

    Nicely explained

  • @rasikakumar1000
    @rasikakumar1000 Před 4 lety +2

    hi, When i try to execute the test script the same way as explained, a blank browser gets launched and returns with session id as null..plz advise

    • @Mukeshotwani
      @Mukeshotwani  Před 4 lety

      Hi Rasika, it means you are not using updated agent or you have updated chrome browser which is not compatible with TestProject.

  • @srikanthchitturi7283
    @srikanthchitturi7283 Před 2 lety

    Thanks for the great Video. Looks like VNC viewer is not open source, do we have any open source apps, please suggest

  • @sauravrajmitra6804
    @sauravrajmitra6804 Před 4 lety +2

    Hello Mukesh, is it possible without using the desired capabilities class...my current project does not have the desired capabilities..how can i run it there

    • @Mukeshotwani
      @Mukeshotwani  Před 4 lety +1

      Hi Saurav we use Selenium Grid in order to run our Selenium test on different node. Without this i don't think it will work. In your framework you can create method for Remote Webdriver or modify existing method.

    • @sauravrajmitra6804
      @sauravrajmitra6804 Před 4 lety

      @@Mukeshotwani yeah that should be the next option...i was just checking if it's possible without that or not...thanks for the answer 🙏

  • @apoorvdwivedi1313
    @apoorvdwivedi1313 Před 3 lety +2

    Hi Mukesh , can we run cucumber tests in parallel on two different browsers ?

    • @Mukeshotwani
      @Mukeshotwani  Před 3 lety +1

      Yes Apoorv why not.

    • @apoorvdwivedi1313
      @apoorvdwivedi1313 Před 3 lety

      @@Mukeshotwani Could you please guide in that direction , Want to run scenarios in parallel on two different browsers ( Chrome and Firefox ) using Cucumber + TestNG

  • @akash8055
    @akash8055 Před 4 lety +1

    Hi Mukesh is there any alternative of testng to dynamically route my test cases to different docker images. Tia

  • @saimanikandanv2300
    @saimanikandanv2300 Před 4 lety +2

    facing this error Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
    Please help am using docker tool box in windows 10 home. My Docker image is chrome standalone 85.0 and i dont have grid setup
    DesiredCapabilities cap=DesiredCapabilities.chrome();
    URL u=new URL("0.0.0.0:4444/wd/hub");
    and also tried URL u=new URL("localhost:4444/wd/hub");

    RemoteWebDriver driver=new RemoteWebDriver(u,cap);

    • @Mukeshotwani
      @Mukeshotwani  Před 4 lety

      HI Saimani, open this url in browser and see if hub is up and running or not
      localhost:4444/wd/hub

  • @harinathannavarapu7559
    @harinathannavarapu7559 Před 5 lety +1

    Kindly post the video on how to retrieve the reports from the container

    • @Mukeshotwani
      @Mukeshotwani  Před 5 lety

      Hi Hari, report part will remain same because we are not changing anything from code except remote url.

  • @anonymous-jb2zn
    @anonymous-jb2zn Před 3 lety +2

    Is it possible to launch chrome/firefox browser without using remote web driver inside a docker container

    • @Mukeshotwani
      @Mukeshotwani  Před 3 lety

      Hi Shaurya, Yes you need to use Selenium grid. Without grid you wont be able to triggerin remote machine.

  • @supriyashetty5204
    @supriyashetty5204 Před 4 lety +2

    When I execute my script in selenium it will connect to the container and it will enter the url in address bar when it starts to load it says no internet connect what is the solution for this

    • @Mukeshotwani
      @Mukeshotwani  Před 4 lety

      Hey Supriya, are you trying with your internal application? Please try running public application like google just to confirm that you are able to run the test on container. If that works then you can set the proxy via Selenium to run your test on container.

  • @meenakshi2356
    @meenakshi2356 Před 4 lety +2

    Hi Mukesh,
    Thanks for sharing the details. I am facing a very strange issue. After 1st successful test execution, if test is triggered for the 2nd time it container kind of hangs. Will have to stop chrome container and then it works. Below is what I see on the grid console window.
    1 requests waiting for a slot to be free.
    Capabilities {browserName: chrome}
    View Config
    Thanks in advance,
    Meenakshi

    • @umangsharma7447
      @umangsharma7447 Před 4 lety

      same is the case with me also.
      4 requests waiting for a slot to be free.
      Capabilities {browserName: chrome}Capabilities {browserName: chrome}Capabilities {browserName: chrome}Capabilities {browserName: chrome}
      not sure why this happens..

  • @poojapalit5571
    @poojapalit5571 Před 4 lety +3

    hi Mukesh, I am constantly getting an error "Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Session [(null externalkey)] not available and is not among the last 1000 terminated sessions.
    " the Hub & nodes are set up just how you have showed and code (using Intellij Idea is) :
    DesiredCapabilities cap = new DesiredCapabilities();
    cap.setBrowserName(BrowserType.FIREFOX);
    WebDriver driver = new RemoteWebDriver(new URL("localhost:4445/wd/hub"), cap);
    driver.manage().window().maximize();
    driver.get("www.google.com/");
    Thread.sleep(10000);
    driver.quit();
    Any help would be greatly appreciated.

    • @Mukeshotwani
      @Mukeshotwani  Před 4 lety

      Hi Pooja, Can you try with Zalenium czcams.com/video/PEjUCkNft7s/video.html

    • @poojapalit5571
      @poojapalit5571 Před 4 lety

      @@Mukeshotwani Hi Mukesh, I have set up Zalenium and I can see the previews. When I run the test its exactly the same behavior, a chrome instance opens and then no activity followed by the same error "org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Session [(null externally)] not available and is not among the last 1000 terminated sessions.
      " Any more pointers would be very helpful. Thanks in advance

  • @seleniumautomation4224
    @seleniumautomation4224 Před 4 lety +2

    Hi Mukesh,
    I need your help in
    Required a password while connecting to my localhost: port number. 127.0.0.1:32762 (VNC Viewer). Where to find the password for this

  • @hanumakottapalli650
    @hanumakottapalli650 Před 4 lety +2

    Hi Mukesh,
    can we pass testng profile in docker compose file? I have different testng profiles for each client, i want to pass the profile name along with docker compose up comamnd. Please help
    Thanks

    • @Mukeshotwani
      @Mukeshotwani  Před 4 lety

      Hi Mate, I am not clear with your requirement, What do you mean by testng profile here?

    • @hanumakottapalli650
      @hanumakottapalli650 Před 4 lety

      @@Mukeshotwani @@Mukeshotwani I am sorry I didn't write properly...I have multiple profiles with client specific xmls in pom.xml..I am using maven docker image and while starting docker-compose cmd I wanted to provide profile name, so it runs specific XML provided in the maven profile

  • @pgulwani
    @pgulwani Před 3 lety

    How do we schedule these Docker tests to run at a specific time during the day?

  • @bsk8643
    @bsk8643 Před 2 lety +2

    You should have covered from scratch ... how to setup container is a big question now..
    How do I practice brother

    • @Mukeshotwani
      @Mukeshotwani  Před 2 lety +1

      Hi Mate,I have already covered in channel, please check 😊

    • @Mukeshotwani
      @Mukeshotwani  Před 2 lety +1

      Here is the link czcams.com/play/PL6flErFppaj1quyeiIF8Rz7nlBPOZTk6d.html

    • @bsk8643
      @bsk8643 Před 2 lety +1

      @@Mukeshotwani thank you so much brother .. this will definetly help alot

  • @jagadishchinta7434
    @jagadishchinta7434 Před 2 lety +1

    Hi Mukesh, I have tried running docker but it ran once and said error..If I run again test get stuck in running mode but nothing happens..Pleas help me

    • @Mukeshotwani
      @Mukeshotwani  Před 2 lety

      Hi Jagadish, make sure you have enough memory if you are using docker containers

  • @pgulwani
    @pgulwani Před 3 lety

    Can we install the Docker Hub/ Nodes on CentOS? How does the Chrome/Firefox browser work here on CentOS

  • @ChiragSharma-zk7ug
    @ChiragSharma-zk7ug Před 3 lety

    Guruji at its best

  • @testaccount9165
    @testaccount9165 Před 2 lety

    hello ,Had
    a doubt ,Is it necessary to write the script in Headless mode to run it in Docker with Aws

  • @sachinsamanta6958
    @sachinsamanta6958 Před 2 lety +1

    I am getting error while running the container "No such host is known", How to fix the issue. Can you please help me.

    • @Mukeshotwani
      @Mukeshotwani  Před 2 lety

      Hi Sachin, make sure hub is active and running before running the test.

  • @shazianiaz4578
    @shazianiaz4578 Před 2 lety +1

    Hi, My execution of test in browser is not showing what to do, I am only getting results pass fail

    • @Mukeshotwani
      @Mukeshotwani  Před 2 lety

      Hi Shazia, by default test will run headless mode.

  • @PanneerSelvam-fu7zh
    @PanneerSelvam-fu7zh Před 4 měsíci +1

    Web driver exception session deleted because page crash. How to solve the issue

    • @Mukeshotwani
      @Mukeshotwani  Před 4 měsíci

      Use update image for grid which version u r using?

  • @madhuribh5824
    @madhuribh5824 Před 3 lety

    How to run selenium from APIs with spring boot in docker I need to run required test cases from APIs please help me do one video on it. Actually api level is working in my local I'm facing issues when I run this in docker .

  • @kandathmurali
    @kandathmurali Před 4 lety +1

    connect: The requested address is not valid in its context. (10049). When I give the port in the vnc viewer, i get this error. Any solutions?

    • @Margarita-sh3kr
      @Margarita-sh3kr Před 4 lety

      i've solved the problem by replacing 0.0.0.0:portNumber with localhost:portNumber

    • @fabianoscco8003
      @fabianoscco8003 Před 4 lety

      @@Margarita-sh3kr and password secret

    • @seleniumautomation4224
      @seleniumautomation4224 Před 4 lety

      It required a password while connecting to my localhost: port number. 127.0.0.1:32762 (VNC Viewer). Where to find password for this

  • @over1498
    @over1498 Před 2 lety +1

    The internet in the container is impossibly slow. Google can't load. Does anyone have any idea how to fix or debug this? The tests work fine locally.

    • @Mukeshotwani
      @Mukeshotwani  Před 2 lety

      Hi Over, container uses system resources so make sure system has enough resources to run test in container.

    • @over1498
      @over1498 Před 2 lety

      @@Mukeshotwani Hm, thanks a ton for the reply. I tried dedicating a lot of resourses to it, but still problems... I did find online, a known issue that running Docker on MacOS, containers have issues inheriting the hosts DNS, and have extreme lag in their own DNS. Will have to look into it more.
      But thanks again, great tutorial.

  • @divakarv7727
    @divakarv7727 Před 2 lety

    hi Mukesh, how to validate the file being download in selenium docker container

  • @vasistatiruveedi690
    @vasistatiruveedi690 Před 4 lety +2

    Hi all ,anyone able to execute in chrome and firefox using docker images ,need help

  • @automationmaven226
    @automationmaven226 Před rokem

    Does this work for selenium IDE?

  • @gurinder22525
    @gurinder22525 Před 2 lety +1

    how to run it on internal website..? How to setup proxy ? please share

    • @Mukeshotwani
      @Mukeshotwani  Před 2 lety

      Do you know Proxy class in selenium ?

    • @gurinder22525
      @gurinder22525 Před 2 lety +1

      @@Mukeshotwani yes..I have tried but. It did not work for me.
      May be I did something wrong

    • @Mukeshotwani
      @Mukeshotwani  Před 2 lety

      @@gurinder22525 can u share code here

    • @Mukeshotwani
      @Mukeshotwani  Před 2 lety

      ?

    • @gurinder22525
      @gurinder22525 Před 2 lety

      ​@@Mukeshotwani
      public static WebDriver dockerChrome() throws Exception {
      String url = "localhost:"+docker_local_port+"/wd/hub";
      capabilities = new DesiredCapabilities();
      Proxy proxy = new Proxy();
      proxy.setHttpProxy("10.140.3.60");
      capabilities.setCapability(CapabilityType.PROXY,proxy);
      capabilities.setBrowserName(BrowserType.CHROME);
      capabilities.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS,true);
      capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
      driver = new RemoteWebDriver(new URL(url),capabilities);
      return driver;
      }