Lets Connect Selenium To Already Opened Browser | Save Time

Поделиться
HTML-код
  • Опубликовано: 20 окт 2024

Комментарии • 10

  • @Udzial
    @Udzial  7 месяцев назад

    github.com/gauravkhuraana/selenium/blob/master/src/test/java/remoteDebugging.java this is the link to the program
    here is the command to start the browser
    chrome.exe --remote-debugging-port=9222 --no-first-run --no-default-browser-check --user-data-dir="C:\Users\gauravkhurana\AppData\Local\Google\Chrome\User Data"
    change gauravkhurana to your user

    • @chandrashekhar6883
      @chandrashekhar6883 7 месяцев назад +1

      Bro it's for local
      And browser specific
      Will it work in grid ,ci,cd env
      There ip address will change

    • @Udzial
      @Udzial  7 месяцев назад

      @@chandrashekhar6883
      It can help locally and save a lot of time, you can try for other browsers as well.
      Concept is important to learn, it even works with playwright too
      It can work in CI environment, you can start the browser programmatically and then selenium will connect to it.
      We mention localhost which refer to the local system and that IP address remains constants always i.e. 127.0.0.1
      The most common use case is to write new scripts and fixing bugs, but it can be tried for other things as well.. like in pipeline. All of what you said is doable but we should try all of that in pipeline if we are stuck with MFA etc problems.

    • @chandrashekhar6883
      @chandrashekhar6883 7 месяцев назад +1

      Agree

    • @sumitsagar6072
      @sumitsagar6072 7 месяцев назад +1

      Bro.. same question my teammate asked me and I told her that no it's not possible... Glad that I got this video.. can save lot of time.. thank you.. keep up the good work🎉

    • @Udzial
      @Udzial  7 месяцев назад

      Thank you @@sumitsagar6072 Feedback like this are very motivating to create new content.
      do subscribe and share this channel and let me know if you want content on some particular topic

  • @saadol678
    @saadol678 Месяц назад +1

    great video, I have a question, what about when I have an already opened chrome with a specific profile and I want to open a new selenium chrome instance with the same profile (just like a new page with the same profile), I tested it but it doesn't work, selenium only works when there is no chrome instance opened with the profile you want, is there any solution to this ?

    • @Udzial
      @Udzial  Месяц назад

      @saadol678 yes it gives error that the profile is in use. Maybe you can create another profile on chrome and use that one for automation. Try edge browser its better than chrome and take less memory.
      so for automation you can use chrome and edge for your other work

  • @sharathchandran7294
    @sharathchandran7294 6 месяцев назад

    @Udzial - awesome work, it's really helpful ! Thanks for sharing this. Do you have command for Mac to start browser?

    • @Udzial
      @Udzial  6 месяцев назад

      try this @sharathchandran7294 and replace yourUsername with your user
      "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --remote-debugging-port=9111 --no-first-run --no-default-browser-check --user-data-dir="/Users/YourUsername/Library/Application Support/Google/Chrome"