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"
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
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.
@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.
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
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.
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);
@@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.
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?
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 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?
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.
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
Hey Parth, please try this code ChromeOptions options = new ChromeOptions(); options.setExperimentalOption("excludeSwitches", new String[]{"enable-automation"}); WebDriver driver = new ChromeDriver(options);
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!!
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.
set window size other wise it wont work ChromeOptions options=new ChromeOptions(); options.addArguments("window-size=1400,800"); options.addArguments("headless");
@@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.
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)
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);
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) {
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"});
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
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");
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"
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?
Hey good to see you after long time as busy schedule not able to check your channel but thanks for updating us buddy :)
Thanks Amit Bhai.. Even I was busy so couldn’t update much videos😊
Hi Mukesh,
thanks for posting this...really very informative video
how to find the location of chrome extensions?
HI Praveen, you can download GetCRX extension. Then whichever extension you want to download right click and save.
Can you post a video where we can use custom google chrome using selenium
Hello Mukhes,
I how conduct UI testing with selenium? Selenium is mostly used for functional testing.
Thank You
Hi Syed, Selenium is doing functional testing with UI only. API testing do functional testing without UI.
Thank you for updating us
:) welcome mate
Thanks Mukesh,Very informative video ..Can you please upload videos about how do we configure Maven Project to Jenkins ..Thanks in advance
Mukesh, any classes on protractor
not yet Shaik coming soon.
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"
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?
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
Hi Mukesh, is it possible to modify headers using desired capabilities?
Hi Sanna, you can use JSExecutor for setting headers.
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.
Hey Sarfraj, try this ruclips.net/video/-gH0LcXp-RE/видео.html
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
Hi Saran,
One example- If you need to do API testing using Restlet Client then you can use the same
Mukesh otwani thanks bro. . .i got it. . .
@@Mukeshotwani - hey mukesh, i did not get this.. could you please elaborate whenever you get some time.. thank you !! :)
Hi Mukesh,
can you tell me how to find the path for extensions downloaded for chrome.
Thanks,
Nikki
Hi Nikki,
I use this to download extensions of Chrome chrome.google.com/webstore/detail/get-crx/dijpllakibenlejkbajahncialkbdkjc
Hi Mukesh,
Under what circumstances we need to set binary path? and why it is required?. Pls enlighten.
How can I enable popups in robot framework using desired capabilities?
Thanks in advance.
Sir, do you know how to run chrome browser as different user in selenium?
@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.
Use pyautogui
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
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.
Please share the complete code too.
what's the solution? Did you find it?
Hello Mukesh,If Chrome browser is not installed in my machine.Can i run my program with headless chrome browser
Yes Sunkari it will work but chromedriver has to be installed either in local machine or remote machine
Hi Mukesh, could you please help me with the code of opening chrome driver as a different user...?
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);
@@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.
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?
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");
}
}
Try this code and if you are still facing any issue then let me know.
@@Mukeshotwani sure will try and let you know
@@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?
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.
hello sir how should i install it through node js to work in java script?
Hi Mate, what is your requirement?
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.
Hi Syed Alam,OTP can not be automated in Selenium.
is it similar to profile?
How to continue code if the given element not found, bcoz its throwing error as of now
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
@@Mukeshotwani Thank you sir
Hi Mukesh,
Is FirefoxProfile similar to that of chromeoptions? Pls correct me if Iam wrong. Thanks in advance.
Yes correct now for Firefox also has FirefoxOptions too
Thanks Mukesh😊
how to disable "chrome is being controlled by automated test software" ?
Hey Parth, please try this code
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches", new String[]{"enable-automation"});
WebDriver driver = new ChromeDriver(options);
How do I disable images?
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!!
Nice One
Thanks Mate
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.
set window size other wise it wont work
ChromeOptions options=new ChromeOptions();
options.addArguments("window-size=1400,800");
options.addArguments("headless");
@@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.
thanks Oindrila for confirming the same.
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)
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
@@Mukeshotwani hi mukesh....i am using testng 7.2.0 and selenium 3.4.0
@@Mukeshotwani selenium 3.141.59 using
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);
Thanks Umang, I will update in my next videos.
@@Mukeshotwani your welcome Mukesh :)
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");
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"});
Thanks Shiva for updates.
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
Hi Mukesh any example or url where I can find this?
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");
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"
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?
@@Mukeshotwani thanks mukesh it is working with maven project
how to enable infobars then?
Hi Mustafa by default infobar comes when you run your script