What is ChromeOptions in Selenium WebDriver

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

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

  • @amitdhanke4013
    @amitdhanke4013 6 лет назад +1

    Hey good to see you after long time as busy schedule not able to check your channel but thanks for updating us buddy :)

    • @Mukeshotwani
      @Mukeshotwani  6 лет назад

      Thanks Amit Bhai.. Even I was busy so couldn’t update much videos😊

  • @praveenautomationinterview2367
    @praveenautomationinterview2367 6 лет назад +2

    Hi Mukesh,
    thanks for posting this...really very informative video
    how to find the location of chrome extensions?

    • @Mukeshotwani
      @Mukeshotwani  6 лет назад

      HI Praveen, you can download GetCRX extension. Then whichever extension you want to download right click and save.

  • @akshayranjith623
    @akshayranjith623 4 года назад +1

    Can you post a video where we can use custom google chrome using selenium

  • @syedalam4729
    @syedalam4729 6 лет назад +1

    Hello Mukhes,
    I how conduct UI testing with selenium? Selenium is mostly used for functional testing.
    Thank You

    • @Mukeshotwani
      @Mukeshotwani  6 лет назад

      Hi Syed, Selenium is doing functional testing with UI only. API testing do functional testing without UI.

  • @sumanthzvakacharla6079
    @sumanthzvakacharla6079 6 лет назад +1

    Thank you for updating us

  • @pavankumarg5091
    @pavankumarg5091 6 лет назад

    Thanks Mukesh,Very informative video ..Can you please upload videos about how do we configure Maven Project to Jenkins ..Thanks in advance

  • @shaikhahmed2289
    @shaikhahmed2289 6 лет назад +1

    Mukesh, any classes on protractor

  • @dimplepodili1126
    @dimplepodili1126 4 года назад

    hi mukesh,i am not able to get the merge option for selenium 3 can u pls get me a solution.
    "The method merge(DesiredCapabilities) is undefined for the type ChromeOptions"
    and after adding selenium 3.6 jar files i am unable to get webdriver also it is coming like this
    "WebDriver cannot be resolved"

  • @syedalam4729
    @syedalam4729 6 лет назад +1

    Hello Mukesh, I was asked a question regarding Jenkins when a job fails after start and I am not physically present how to resume that job?

    • @Mukeshotwani
      @Mukeshotwani  6 лет назад

      Hi Syed Alam, You can use cron pattern which will schedule the job automatically. Please refer below video for the same ruclips.net/video/4PTYVIaBT1Q/видео.html

  • @sannasaravanan496
    @sannasaravanan496 4 года назад +1

    Hi Mukesh, is it possible to modify headers using desired capabilities?

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      Hi Sanna, you can use JSExecutor for setting headers.

  • @sarfrajansari1758
    @sarfrajansari1758 4 года назад +1

    Hi mukesh,So I am trying to use selenium on a website it have 3step login process which quite heptic but if i use my browser it getting logged in automatically.Is there any process to open selenium driver with my profile or cookie of that login.

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      Hey Sarfraj, try this ruclips.net/video/-gH0LcXp-RE/видео.html

  • @27saranraj
    @27saranraj 6 лет назад +1

    Hi bro , What is the use of adding chrome extension in browser, could please tell where we really use the extension in selenium web app automation

    • @Mukeshotwani
      @Mukeshotwani  6 лет назад

      Hi Saran,
      One example- If you need to do API testing using Restlet Client then you can use the same

    • @27saranraj
      @27saranraj 6 лет назад

      Mukesh otwani thanks bro. . .i got it. . .

    • @umangsharma7447
      @umangsharma7447 5 лет назад

      @@Mukeshotwani - hey mukesh, i did not get this.. could you please elaborate whenever you get some time.. thank you !! :)

  • @nikkibakshi6538
    @nikkibakshi6538 6 лет назад +1

    Hi Mukesh,
    can you tell me how to find the path for extensions downloaded for chrome.
    Thanks,
    Nikki

    • @Mukeshotwani
      @Mukeshotwani  6 лет назад +1

      Hi Nikki,
      I use this to download extensions of Chrome chrome.google.com/webstore/detail/get-crx/dijpllakibenlejkbajahncialkbdkjc

  • @selvamkandharaja3415
    @selvamkandharaja3415 6 лет назад

    Hi Mukesh,
    Under what circumstances we need to set binary path? and why it is required?. Pls enlighten.

  • @subasthapa8895
    @subasthapa8895 5 лет назад

    How can I enable popups in robot framework using desired capabilities?
    Thanks in advance.

  • @liteteeskothammudu1551
    @liteteeskothammudu1551 3 года назад

    Sir, do you know how to run chrome browser as different user in selenium?

  • @MorningShine24
    @MorningShine24 4 года назад

    @Mukesh, Thanks for the video. I have a chrome plugin and after a page load say www.google.com, I need to click on that chrome extension icon. How do i click on that icon? Please clarify.

    • @KaliKofi
      @KaliKofi 4 года назад

      Use pyautogui

  • @saranyakarthik
    @saranyakarthik 5 лет назад

    Hi, when I add an extension, a second tab opens in chrome which says abt the extension. My website opens in the first tab and ends up as error. how to avoid that? pls help

  • @kowsalyakabi4562
    @kowsalyakabi4562 5 лет назад +1

    HI Mukesh,
    can you please tell me the chromeoption to set the language to english??
    options.addArguments("--lang=en-us");
    I tried this, but it didn't work.

  • @sunkarimounika6229
    @sunkarimounika6229 6 лет назад +1

    Hello Mukesh,If Chrome browser is not installed in my machine.Can i run my program with headless chrome browser

    • @Mukeshotwani
      @Mukeshotwani  6 лет назад +1

      Yes Sunkari it will work but chromedriver has to be installed either in local machine or remote machine

  • @abcpandey13
    @abcpandey13 4 года назад +1

    Hi Mukesh, could you please help me with the code of opening chrome driver as a different user...?

    • @Mukeshotwani
      @Mukeshotwani  4 года назад +1

      Hi Swati, please try below code
      // Create Object of ChromeOption Class
      ChromeOptions option = new ChromeOptions();
      // add the path of which user you want to use
      option.addArguments("user-data-dri=C:\\Users\\Your path to user\\Roaming\\Google\\Chrome\\User Data");
      // pass option object in ChromeDriver constructor
      WebDriver driver = new ChromeDriver(option);

    • @shyamsundersiraveni5178
      @shyamsundersiraveni5178 3 года назад

      @@Mukeshotwani Hi Mukesh, Could you please help me in launching the chrome with different user which is in different domain than the current logged in system domain.

  • @neetigoyal9075
    @neetigoyal9075 4 года назад +1

    hi Mukesh, is there any way to handle Single Sign on , eg.if i am logging in my application with my enterprise id (which i am passing for the first time login) and then under my application i clicked on some link which redirects me to new window which also accepts the same login credentials .So while validating manually it automatically takes my credentials , but when using Selenium it opens a new session asking for credentials.So is there any way to handle this by passing any setting to chrome driver?

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      Hi Neeti, I have done same scenario in my org. When I open manually my application takes SSO and no login window present on web but when I run on VM then application ask for login details. This is the logic which I used.
      public void loginWindowPresent(String username, String password)
      {
      if(driver.findElements(By.xpath("here keep the username field or any field which comes on login window")).size()>0)
      {
      System.out.println("LOG:INFO- Login window present");
      // write your code here to login
      }
      else
      {
      System.out.println("LOG:INFO- SSO Enabled Logged in using SSO");
      }
      }

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      Try this code and if you are still facing any issue then let me know.

    • @neetigoyal9075
      @neetigoyal9075 4 года назад +1

      @@Mukeshotwani sure will try and let you know

    • @neetigoyal9075
      @neetigoyal9075 4 года назад +1

      @@Mukeshotwani so just one thing here what i understood from code, if that login window is coming up again , we are providing the login credentials again .We are actually not bypassing SSO , we are just giving the alternate solution , to check if login window comes up again then enter the credentials again.Right?

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      Yes true we are not bypassing we are handling login window. You need to identify whenever we get login section we can call the method which I mentioned above.
      Selenium does not have any option to bypass sso.

  • @火影-z9r
    @火影-z9r 4 года назад +1

    hello sir how should i install it through node js to work in java script?

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      Hi Mate, what is your requirement?

  • @syedalam4729
    @syedalam4729 6 лет назад +1

    How to automate OTP in selenium. Each time I invoke the browser it asks me otp where the code is given via email. Please help. Thank You.

    • @Mukeshotwani
      @Mukeshotwani  6 лет назад

      Hi Syed Alam,OTP can not be automated in Selenium.

  • @swapnilgujar6398
    @swapnilgujar6398 3 года назад

    is it similar to profile?

  • @automateboringstuffwithraj
    @automateboringstuffwithraj 4 года назад +1

    How to continue code if the given element not found, bcoz its throwing error as of now

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      Hi Rajinder, if element is not present then ideally test should fail but still you want to run the test then use try catch.ruclips.net/video/cjNVLIBXoes/видео.html

    • @automateboringstuffwithraj
      @automateboringstuffwithraj 4 года назад

      @@Mukeshotwani Thank you sir

  • @selvamkandharaja3415
    @selvamkandharaja3415 6 лет назад +1

    Hi Mukesh,
    Is FirefoxProfile similar to that of chromeoptions? Pls correct me if Iam wrong. Thanks in advance.

  • @parthjangid3587
    @parthjangid3587 4 года назад +1

    how to disable "chrome is being controlled by automated test software" ?

    • @Mukeshotwani
      @Mukeshotwani  4 года назад +1

      Hey Parth, please try this code
      ChromeOptions options = new ChromeOptions();
      options.setExperimentalOption("excludeSwitches", new String[]{"enable-automation"});
      WebDriver driver = new ChromeDriver(options);

  • @abusiness8783
    @abusiness8783 6 лет назад

    How do I disable images?

  • @chhavichaudhary5874
    @chhavichaudhary5874 4 года назад

    Hi Mukesh,
    My script is downloading no. Of file but whenever the file is NOT pdf it's showing chrome related pop up "this file can harm your system... " I tried using the below code but nothing happening... Could you please check once if any updates required in below code:-
    Optn=webdriver.ChromeOptions()
    Optn. add_argument('--safebrowsing-disable-download-protection')
    Prefs={"download.default_directory":"c:
    ewdownloads", "download.prompt_for_download:False, " download.directory_upgrade": True}
    Optn.add_experimental_option("prefs", prefs)
    Driver= webdriver.chrome(chrome_options=opts)
    Thank you in advance!!

  • @kmrajay237
    @kmrajay237 6 лет назад +1

    Nice One

  • @oindrilachakraborty8348
    @oindrilachakraborty8348 4 года назад +1

    Hi Mukesh, "headless" argument option is not working for ChromeOptions class. Following is my code -
    WebDriverManager.chromedriver().setup();

    ChromeOptions options = new ChromeOptions();
    options.addArguments("--headless");

    driver = new ChromeDriver(options);
    driver.get("www.google.com");

    Thread.sleep(2000);

    WebElement txtSearchBox = driver.findElement(By.name("q"));
    txtSearchBox.sendKeys("Selenium Automation Testing");
    txtSearchBox.sendKeys(Keys.ENTER);
    I have also tried using "options.setHeadless(true);". This also didn't work.Could you please provide a solution. Thanks in advance.

    • @Shivakumar-nl2li
      @Shivakumar-nl2li 4 года назад +1

      set window size other wise it wont work
      ChromeOptions options=new ChromeOptions();
      options.addArguments("window-size=1400,800");
      options.addArguments("headless");

    • @oindrilachakraborty8348
      @oindrilachakraborty8348 4 года назад

      @@Shivakumar-nl2li It did work as it was in my code. No need to give window size. Previously the icon of chrome used to come in taskbar. Now it is not coming. That is why I thought it was not working. But it was.

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      thanks Oindrila for confirming the same.

  • @ramyatippannavar8812
    @ramyatippannavar8812 4 года назад +1

    hi mukesh,i am unable to disable infobar and chrome some notification also.included chromeoptions class in code it is throwing error after running.
    this is error----
    [RemoteTestNG] detected TestNG version 7.2.0
    FAILED CONFIGURATION: @BeforeClass startup
    java.lang.NoSuchMethodError: org.openqa.selenium.chrome.ChromeOptions.addArguments([Ljava/lang/String;)Lorg/openqa/selenium/chrome/ChromeOptions;
    at com.pages.Pageclass.startapplicaction(Pageclass.java:17)
    at com.loginpage.BaseClass.startup(BaseClass.java:43)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:135)
    at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:64)
    at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:364)
    at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:318)
    at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:176)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:122)
    at java.util.ArrayList.forEach(Unknown Source)
    at org.testng.TestRunner.privateRun(TestRunner.java:767)
    at org.testng.TestRunner.run(TestRunner.java:588)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      Hi Ramya, which Selenium version you are using? This option is available after Selenium 3.6 and also please use TestNG version 6.9.10

    • @ramyatippannavar8812
      @ramyatippannavar8812 4 года назад

      @@Mukeshotwani hi mukesh....i am using testng 7.2.0 and selenium 3.4.0

    • @ramyatippannavar8812
      @ramyatippannavar8812 4 года назад

      @@Mukeshotwani selenium 3.141.59 using

  • @umangsharma7447
    @umangsharma7447 5 лет назад +1

    Hi Mukesh, i was just checking that disable infobar is now deprecated.
    We have to use another way to disable infobars.
    I came across below link with the alternative to disable infobar in chrome.
    help.applitools.com/hc/en-us/articles/360007189411--Chrome-is-being-controlled-by-automated-test-software-notification
    ChromeOptions options = new ChromeOptions();
    options.setExperimentalOption("excludeSwitches", new String[]{"enable-automation"});
    WebDriver driver = new ChromeDriver(options);

    • @Mukeshotwani
      @Mukeshotwani  5 лет назад +1

      Thanks Umang, I will update in my next videos.

    • @umangsharma7447
      @umangsharma7447 5 лет назад

      @@Mukeshotwani your welcome Mukesh :)

  • @neerajyadav-wt4cn
    @neerajyadav-wt4cn 4 года назад

    Hi Mukesh, I tried the following code that I sent you but my infobars not working..means "--disable-infobars" with chrome options class. Kindly check the code.Thanks .
    public class Google {
    public static void main(String[] args) {


    //Also delete all the warnigs from chrome..

    System.setProperty(ChromeDriverService.CHROME_DRIVER_SILENT_OUTPUT_PROPERTY, "true");

    //System.setProperty("webdriver.firefox.marionette","C:\\Program Files\\geckodriver.exe");
    //WebDriver driver = new FirefoxDriver();
    System.setProperty("webdriver.chrome.driver", "C:\\Users\
    eeraj_yadav\\Desktop\\chromedriver.exe");
    WebDriver driver= new ChromeDriver();


    ChromeOptions option = new ChromeOptions();
    //option.addArguments("--disable-infobars");
    option.addArguments("--disable-infobars");

    driver.manage().window().maximize();
    driver.manage().deleteAllCookies();

    driver.get("www.google.com/");
    driver.findElement(By.xpath("//input[@class='gLFyf gsfi']")).sendKeys("aaj tak");

    • @Shivakumar-nl2li
      @Shivakumar-nl2li 4 года назад +1

      as per new changes in Feb 2020 , it is not working .. pls check with new way below code
      options.setExperimentalOption("excludeSwitches",new String[]{"enable-automation"});

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      Thanks Shiva for updates.

  • @mukeshgiri3723
    @mukeshgiri3723 5 лет назад +1

    how to handle "Access Denied" using selenium webDriver
    with java
    You don't have permission to access "@t" on this server.
    Reference #18.26eef873.1558255274.19e2e8b

    • @Mukeshotwani
      @Mukeshotwani  5 лет назад +1

      Hi Mukesh any example or url where I can find this?

  • @SandeepKumar-xs4xh
    @SandeepKumar-xs4xh 3 года назад +1

    I tried this code & it's not working. I'm using selenium version 3.141. and tried with JUnit 5. (Sorry cannot disclose company URL or complete code, So copy-pasted code of the issue). Any solution.?
    Steps:-
    1.Launch browser and enter the url.
    2.Click on a link and new tab opens.
    3.Navigate to new tab using WindowHandle concept.
    4.Try to Allow access to Microphone in new tab as displayed in screenshot above.(Not Working).
    System.setProperty("webdriver.chrome.driver", "./drivers"+File.separator+"chromedriver.exe");
    DesiredCapabilities cap = new DesiredCapabilities();
    ChromeOptions options = new ChromeOptions();
    //options.addArguments("--disable-notifications");
    options.addArguments("start-maximised");
    options.addArguments("--disable-infobars");
    options.merge(cap);
    WebDriver driver = new ChromeDriver(options);
    System.out.println("Browser launched");

  • @dimplepodili1126
    @dimplepodili1126 4 года назад +1

    hi mukesh,i am not able to get the merge option for selenium 3 can u pls get me a solution.
    "The method merge(DesiredCapabilities) is undefined for the type ChromeOptions"
    and after adding selenium 3.6 jar files i am unable to get webdriver also it is coming like this
    "WebDriver cannot be resolved"

    • @Mukeshotwani
      @Mukeshotwani  4 года назад

      Hi Dimple, please use maven project and use Selenium 3.141.59 version which is stable. Which project are you using, is it plain java project or maven project?

    • @dimplepodili1126
      @dimplepodili1126 4 года назад

      @@Mukeshotwani thanks mukesh it is working with maven project

  • @mustuanju
    @mustuanju 5 лет назад +1

    how to enable infobars then?

    • @Mukeshotwani
      @Mukeshotwani  5 лет назад

      Hi Mustafa by default infobar comes when you run your script