Now, that method is deprecated. For example you can use this code: DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); capabilities.setCapability("ignoreZoomSetting", true); InternetExplorerDriverService service = new InternetExplorerDriverService.Builder() .usingDriverExecutable(new File(driverPath + "\\src\\drivers\\IEDriverServer.exe")) .usingAnyFreePort() .build(); InternetExplorerOptions options = new InternetExplorerOptions(); options.merge(capabilities); webDriver = new InternetExplorerDriver(service, options);
WebDriver Manager is to skip the manual download and adding of browser executable file DesiredCapabilities to to set the options for the browser like Zoom level, window size etc So 2 different things here Vishal
Hi Raghav, is this DesiredCapabilities still good to use these days as best practice? I can only see the use of this when testing mobile app / browser in appium
DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability("marionette", true); WebDriver driver = new FirefoxDriver(capabilities); I am learning Selenium. There is a class with name DesiredCapabilities which is used to set properties of browser. My question here is in the first statement while creating object of DesiredCapabilities class, why are we not using 'new' keyword? I am just trying to understand this concept here. Any answers?
Hi raghav, I am trying to automate a scenario where i need to download file on safari mobile browser, as part of that it is displaying alert with options view and download. I tried implementing alert but it throwing exception saying alert is not supported. Can you help me how to resolve this.
Hi, Is there a way to parametarize the Desired Capabilities in katalon? because whenever I use download.default_directory : String : ${userDownloads} It is not working But If I use my normal Directory : download.default_directory : String : C:\Users\Brylesu\Downloads Files are downloading in Chrome Headless
In my case IE can't find any locator, nor by name, nor by xpath. The same locators work for chrome and firefox but in ie i have error message: "Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find element with css selector == *[name='q']" or "Unable to find element with xpath == //input[@title='Поиск']". Same with the button.
Hi Alexy, automation on IE is usually not so smooth as in chrome or firefox. You can check on IE the locators that work. Usually the locators that work on IE should work on chrome and firefox
Hi Raghav, i am having the same issue when using desiredcapabilities to ignore "ignoreProtectedModeSettings", the script worked fine on IE if i am not using this, can you advice? thanks.
Update: i am able to locate the element now after set a initial browser url. capabilities.setCapability(InternetExplorerDriver.INITIAL_BROWSER_URL, "www.google.com"); hope this helps.
Hi Raghav, I am trying to use MS edge browser and getting this error message "Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot find MSEdge binary"
In my organisation I have created a test automation using qaf (qmetry automation framework). My target is to run this functional test cases automatically in CICD pipeline. We have a system where when code check-in was complete then the Jenkins tool will trigger the functional test cases automatically and it runs in available VDI. We have 20-30 VDI out of which it will pick one and run the tests. Picking the random VDI means will not have standard username and password to login into application and I cannot manually enter username password because we use auto authentications(application logs in based on windows profile). My plan is to create some service account and provide access to that service account. Since the service account do not match with VDI profile. Is there any way I can make use of chrome custom profile where chrome driver wouldn't take default window profile and take custom profile related to service accounts and start executing the tests?
Hi Ria, pls chekc this sqa.stackexchange.com/questions/23559/what-is-the-difference-between-desiredcapabilities-chromeoptions-and-when-to-u sites.google.com/a/chromium.org/chromedriver/capabilities
Hi Raghav, Looks like DesiredCapabilities is deprecated for IE browser, DesiredCapabilities caps = new DesiredCapabilities(); caps.setCapability("ignoreProtectedModeSettings", true); System.setProperty("webdriver.ie.driver", "D:/2019/Software/IEDriverServer.exe"); WebDriver driver = new InternetExplorerDriver(caps); // InternetExplorerDriver getting string of (saying deprecated)
Hi Ramesh Now, that method is deprecated. For example you can use this code: DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer(); capabilities.setCapability("ignoreZoomSetting", true); InternetExplorerDriverService service = new InternetExplorerDriverService.Builder() .usingDriverExecutable(new File(driverPath + "\\src\\drivers\\IEDriverServer.exe")) .usingAnyFreePort() .build(); InternetExplorerOptions options = new InternetExplorerOptions(); options.merge(capabilities); webDriver = new InternetExplorerDriver(service, options);
Hi, you can use TestNG and create a teardown func. This will have code to close browser and it should be called after all tests have competed. And in your tests you can add the continuity for example after login test, the next test starts with homepage. Check related videos here - th-cam.com/play/PLhW3qG5bs-L8oRay6qeS70vJYZ3SBQnFa.html
Hi sir, Iam filling Application form in that we have EMail field after filling all fields if we click on save we get Success Message , after getting Success message need to flow with next functionality, if i filling application again i have given in Email filed already registered Email after filling all field if i click on Save then we get an Message like “Email already Register” after getting this message we click back button and again same functionality what we done after success Message Here what my doubt is Message won’t come everytime of our filling application it comes only when we give already registered Mail, when we get message then only we need click to Back button and perform next functionality What i did is i have taken Xpath of message use IsDisplayed() if it display then click on Back button and next functionality Else next functinalty For me If Message not present then else statement is not woking and also I tried with Try Catch block even not work can you please suggest anyother way to over come this. I think my Text is very lengthy but please suggest I don’t want this as 2 scenarios like(already registered mail, new mail) need in single scenario
@@RaghavPal Yes Raghav here it is. It is as simple as just launch 3 browsers and it closes chrome, firefox but each time IE not closed and Console shows option to terminate. [RemoteTestNG] detected TestNG version 7.0.0 SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See www.slf4j.org/codes.html#StaticLoggerBinder for further details. Starting ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945@{#614}) on port 14220 Only local connections are allowed. Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code. Started InternetExplorerDriver server (64-bit) 3.150.0.0 Listening on port 39144 Only local connections are allowed 1577811922867 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\Deepak\\AppData\\Local\\Temp\ ust_mozprofilesThghV" Dec 31, 2019 10:35:23 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C This is Chrome Thread : 11 Test ran successfully This is Firefox Thread : 13 Dec 31, 2019 10:35:25 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C 1577811945989 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons 1577811945989 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: telemetry 1577811945990 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/ 1577811945990 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: about:reader* JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory. 1577811951504 Marionette INFO Listening on port 50775 1577811951909 Marionette WARN TLS certificate errors will be ignored for this session Dec 31, 2019 10:35:52 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: W3C This is IE Thread : 12 JavaScript error: ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js, line 6: Error: [$injector:modulerr] errors.angularjs.org/1.4.8/$injector/modulerr?p0=Registerform&p1=%5B%24injector%3Amodulerr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.4.8%2F%24injector%2Fmodulerr%3Fp0%3Dui.grid%26p1%3D%255B%2524injector%253Anomod%255D%2520http%253A%252F%252Ferrors.angularjs.org%252F1.4.8%252F%2524injector%252Fnomod%253Fp0%253Dui.grid%250AG%252F%253C%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A6%253A416%250Ade%252F%253C%252F%253C%252F%253C%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A24%253A186%250Ab%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A23%253A251%250Ade%252F%253C%252F%253C%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A23%253A494%250Ag%252F%253C%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A38%253A117%250An%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A7%253A333%250Ag%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A37%253A489%250Ag%252F%253C%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A38%253A134%250An%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A7%253A333%250Ag%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A37%253A489%250Aeb%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A41%253A249%250Ac%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A19%253A463%250Ayc%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A20%253A274%250AZd%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A19%253A83%250A%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A294%253A194%250Ai%2540https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fjquery%252F1.12.0%252Fjquery.min.js%253A2%253A27451%250AfireWith%2540https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fjquery%252F1.12.0%252Fjquery.min.js%253A2%253A28215%250Aready%2540https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fjquery%252F1.12.0%252Fjquery.min.js%253A2%253A30008%250AK%2540https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fjquery%252F1.12.0%252Fjquery.min.js%253A2%253A30370%250A%0AG%2F%3C%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A6%3A416%0Ag%2F%3C%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A38%3A391%0An%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A7%3A333%0Ag%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A37%3A489%0Ag%2F%3C%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A38%3A134%0An%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A7%3A333%0Ag%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A37%3A489%0Aeb%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A41%3A249%0Ac%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A19%3A463%0Ayc%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A20%3A274%0AZd%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A19%3A83%0A%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A294%3A194%0Ai%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.12.0%2Fjquery.min.js%3A2%3A27451%0AfireWith%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.12.0%2Fjquery.min.js%3A2%3A28215%0Aready%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.12.0%2Fjquery.min.js%3A2%3A30008%0AK%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.12.0%2Fjquery.min.js%3A2%3A30370%0A Test ran successfully 1577811955704 Marionette INFO Stopped listening on port 50775 [Child 4984, Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1575282935/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341 [Child 3244, Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1575282935/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341 [Child 3244, Chrome_ChildThread] WARNING: pipe error: 1[Parent 6700, Gecko_IOThread] WARNING: pipe error: 109: file z:/task_1575282935/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341 [Child 5488, Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1575282935/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341 [GPU 7796, Chrome_ChildThread] WARNING: pipe error: 109: fi
When I try to use Desired capabilities, I got this message "The constructor InternetExplorerDriver(Capabilities) is deprecated" In IE Browser, displays "This is the initial start page for the WebDriver server." only
Hi Raghavendra, Use InternetExplorerDriverService, InternetExplorerOptions if you see the documentation its mentioned @Deprecated public InternetExplorerDriver(InternetExplorerDriverService service, Capabilities capabilities) Deprecated. Use InternetExplorerDriver(InternetExplorerDriverService, InternetExplorerOptions) www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/ie/InternetExplorerDriver.html#InternetExplorerDriver-org.openqa.selenium.Capabilities-
I struggled with the IE for a long time, it can't findElement of search input in google. In console written SCRIPT5: Access is denied. Try to use InternetExplorerOptions with different capabilities but no fix. Google also didn't help. So to not lose more time, I just skip the lesson.
Hi Rajat, For your case, this will help www.maisasolutions.com/blog/How-o-get-X-Y-coordinates-of-element-in-Selenium-WebDriver stackoverflow.com/questions/21888317/how-to-verify-the-position-of-the-web-page-element In case you want to do any visual validation, you can use Applitools, I have a video in the playlist - th-cam.com/play/PLhW3qG5bs-L8oRay6qeS70vJYZ3SBQnFa.html
Mate you are the best on utube!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! thanks
Thanks a lot Vik, Humbled
Very informative ... I liked it too much
Glad to know this Azharuddin
hello, this chapter is deprecated since Selenium 4. thanks for your work.
thanks for the info, will check
Now, that method is deprecated. For example you can use this code:
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability("ignoreZoomSetting", true);
InternetExplorerDriverService service = new InternetExplorerDriverService.Builder()
.usingDriverExecutable(new File(driverPath + "\\src\\drivers\\IEDriverServer.exe"))
.usingAnyFreePort()
.build();
InternetExplorerOptions options = new InternetExplorerOptions();
options.merge(capabilities);
webDriver = new InternetExplorerDriver(service, options);
Thanks for the information Roman
Which approach is best using desired capabilities to launch browser or web driver manger to launch browser…
WebDriver Manager is to skip the manual download and adding of browser executable file
DesiredCapabilities to to set the options for the browser like Zoom level, window size etc
So 2 different things here Vishal
Hi Raghav, is this DesiredCapabilities still good to use these days as best practice? I can only see the use of this when testing mobile app / browser in appium
Hi Mikkee, it is if you are creating your own framework. There is much more you can do with it. Can check some examples online
@@RaghavPal thank you Raghav. Yes currently I am creating my own framework and your POM design tutorial are really good. Raghav number 1!
Hi Raghav,
Is it possible to use safari browser for automation in Windows ?
Safari works on mac, so I believe there will not be a direct way to use it on windows
Yes I noticed it
Thanks for your videos
Thanks went through a lot of videos but this really helped. Thanks again, do you provide in person training.
Most welcome Ankit
DesiredCapabilities capabilities = DesiredCapabilities.firefox();
capabilities.setCapability("marionette", true);
WebDriver driver = new FirefoxDriver(capabilities);
I am learning Selenium. There is a class with name DesiredCapabilities which is used to set properties of browser. My question here is in the first statement while creating object of DesiredCapabilities class, why are we not using 'new' keyword? I am just trying to understand this concept here.
Any answers?
Hi Punit, new is used in the video. Pls check again
You are just amazing, the quality of teaching is awesome..Tysm for your efforts for making Automation easy 😊✌️
You're welcome Syed
@@RaghavPal Are you currently working in any company?
No Syed.
Raghav bro, I have a doubt regarding poi API for excel.. Have questioned you in that video session😅
I will check Syed
Wish you can make more video abt desired capabilities, I see this library has many using in selenium and solve many stuff
I will try that Duc
Hi raghav,
I am trying to automate a scenario where i need to download file on safari mobile browser, as part of that it is displaying alert with options view and download. I tried implementing alert but it throwing exception saying alert is not supported. Can you help me how to resolve this.
Hi Manu, will need to check on this, have you tried using appium
Good Explanation
Thanks for watching Sharat
Hi, Is there a way to parametarize the Desired Capabilities in katalon? because whenever I use
download.default_directory : String : ${userDownloads}
It is not working
But If I use my normal Directory : download.default_directory : String : C:\Users\Brylesu\Downloads
Files are downloading in Chrome Headless
Check this docs.katalon.com/katalon-studio/docs/introduction-to-desired-capabilities.html
In my case IE can't find any locator, nor by name, nor by xpath. The same locators work for chrome and firefox but in ie i have error message: "Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find element with css selector == *[name='q']" or "Unable to find element with xpath == //input[@title='Поиск']". Same with the button.
Hi Alexy, automation on IE is usually not so smooth as in chrome or firefox. You can check on IE the locators that work. Usually the locators that work on IE should work on chrome and firefox
Same is happening for me, can't find locator
Hi Raghav, i am having the same issue when using desiredcapabilities to ignore "ignoreProtectedModeSettings", the script worked fine on IE if i am not using this, can you advice? thanks.
Update: i am able to locate the element now after set a initial browser url.
capabilities.setCapability(InternetExplorerDriver.INITIAL_BROWSER_URL, "www.google.com");
hope this helps.
Please do more vedios on desired capabilities....
Sure Ramesh, I will do
Thank you Raghav for considering my request. I am looking for your vedios..
Hi Raghav, I am trying to use MS edge browser and getting this error message "Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot find MSEdge binary"
Hi Rahul, pls check from here in case you missed any step - www.seleniumeasy.com/selenium-tutorials/launching-microsoft-edge-browser-using-selenium-3
In my organisation I have created a test automation using qaf (qmetry automation framework). My target is to run this functional test cases automatically in CICD pipeline. We have a system where when code check-in was complete then the Jenkins tool will trigger the functional test cases automatically and it runs in available VDI. We have 20-30 VDI out of which it will pick one and run the tests. Picking the random VDI means will not have standard username and password to login into application and I cannot manually enter username password because we use auto authentications(application logs in based on windows profile). My plan is to create some service account and provide access to that service account. Since the service account do not match with VDI profile. Is there any way I can make use of chrome custom profile where chrome driver wouldn't take default window profile and take custom profile related to service accounts and start executing the tests?
Hi Sati, not very sure, will need to check online
Hi, Please tell me the difference between Desired Capabilities and ChromeDriver Options?
Hi Ria, pls chekc this
sqa.stackexchange.com/questions/23559/what-is-the-difference-between-desiredcapabilities-chromeoptions-and-when-to-u
sites.google.com/a/chromium.org/chromedriver/capabilities
Thank you!
You're welcome Limbrit
Hi Raghav,
Looks like DesiredCapabilities is deprecated for IE browser,
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("ignoreProtectedModeSettings", true);
System.setProperty("webdriver.ie.driver", "D:/2019/Software/IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver(caps);
// InternetExplorerDriver getting string of (saying deprecated)
driver.get("google.com");
driver.findElement(By.name("q")).sendKeys("ABCD");
driver.findElement(By.name("btnk")).sendKeys(Keys.RETURN);
driver.quit();
Hi Ramesh
Now, that method is deprecated. For example you can use this code:
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability("ignoreZoomSetting", true);
InternetExplorerDriverService service = new InternetExplorerDriverService.Builder()
.usingDriverExecutable(new File(driverPath + "\\src\\drivers\\IEDriverServer.exe"))
.usingAnyFreePort()
.build();
InternetExplorerOptions options = new InternetExplorerOptions();
options.merge(capabilities);
webDriver = new InternetExplorerDriver(service, options);
Thank you Raghav for your quick reply.
Can we use these desired capabilities with other browsers?
If yes, then please also provide another example with chromedriver too.
Hi, yes you can, I will plan to add more sessions on that. For now you can try with some online help
could you please tell me how to run test cases continuously on same browser with out opening new browser or closing the exiting browser.
Hi, you can use TestNG and create a teardown func. This will have code to close browser and it should be called after all tests have competed. And in your tests you can add the continuity for example after login test, the next test starts with homepage. Check related videos here - th-cam.com/play/PLhW3qG5bs-L8oRay6qeS70vJYZ3SBQnFa.html
Hi sir,
Iam filling Application form in that we have EMail field after filling all fields if we click on save we get Success Message , after getting Success message need to flow with next functionality, if i filling application again i have given in Email filed already registered Email after filling all field if i click on Save then we get an Message like “Email already Register” after getting this message we click back button and again same functionality what we done after success Message
Here what my doubt is Message won’t come everytime of our filling application it comes only when we give already registered Mail, when we get message then only we need click to Back button and perform next functionality
What i did is i have taken Xpath of message use IsDisplayed() if it display then click on Back button and next functionality Else next functinalty
For me If Message not present then else statement is not woking and also I tried with Try Catch block even not work can you please suggest anyother way to over come this.
I think my Text is very lengthy but please suggest
I don’t want this as 2 scenarios like(already registered mail, new mail) need in single scenario
Hi Wasim, generally the condition should work here, May need to check your code and setup
If Message doesn’t display in page then
If(messgaexpath.isdisplay()) not returing false it is stopping at if condition
Can check with the locators you are using, if that is able to find the message window
Hi Raghav, My tear down method never get called, even in my live project package.
@AfterSuite
public void tearDown() {
driver.close();
driver.quit();
}
Hi Deepak, do you have any logs for this. Will need to see the code to troubleshoot
@@RaghavPal Yes Raghav here it is. It is as simple as just launch 3 browsers and it closes chrome, firefox but each time IE not closed and Console shows option to terminate.
[RemoteTestNG] detected TestNG version 7.0.0
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Starting ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945@{#614}) on port 14220
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
Started InternetExplorerDriver server (64-bit)
3.150.0.0
Listening on port 39144
Only local connections are allowed
1577811922867 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\Deepak\\AppData\\Local\\Temp\
ust_mozprofilesThghV"
Dec 31, 2019 10:35:23 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
This is Chrome
Thread : 11
Test ran successfully
This is Firefox
Thread : 13
Dec 31, 2019 10:35:25 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
1577811945989 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: mozillaAddons
1577811945989 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: telemetry
1577811945990 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: resource://pdf.js/
1577811945990 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid extension permission: about:reader*
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
1577811951504 Marionette INFO Listening on port 50775
1577811951909 Marionette WARN TLS certificate errors will be ignored for this session
Dec 31, 2019 10:35:52 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
This is IE
Thread : 12
JavaScript error: ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js, line 6: Error: [$injector:modulerr] errors.angularjs.org/1.4.8/$injector/modulerr?p0=Registerform&p1=%5B%24injector%3Amodulerr%5D%20http%3A%2F%2Ferrors.angularjs.org%2F1.4.8%2F%24injector%2Fmodulerr%3Fp0%3Dui.grid%26p1%3D%255B%2524injector%253Anomod%255D%2520http%253A%252F%252Ferrors.angularjs.org%252F1.4.8%252F%2524injector%252Fnomod%253Fp0%253Dui.grid%250AG%252F%253C%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A6%253A416%250Ade%252F%253C%252F%253C%252F%253C%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A24%253A186%250Ab%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A23%253A251%250Ade%252F%253C%252F%253C%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A23%253A494%250Ag%252F%253C%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A38%253A117%250An%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A7%253A333%250Ag%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A37%253A489%250Ag%252F%253C%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A38%253A134%250An%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A7%253A333%250Ag%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A37%253A489%250Aeb%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A41%253A249%250Ac%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A19%253A463%250Ayc%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A20%253A274%250AZd%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A19%253A83%250A%2540http%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fangularjs%252F1.4.8%252Fangular.min.js%253A294%253A194%250Ai%2540https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fjquery%252F1.12.0%252Fjquery.min.js%253A2%253A27451%250AfireWith%2540https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fjquery%252F1.12.0%252Fjquery.min.js%253A2%253A28215%250Aready%2540https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fjquery%252F1.12.0%252Fjquery.min.js%253A2%253A30008%250AK%2540https%253A%252F%252Fajax.googleapis.com%252Fajax%252Flibs%252Fjquery%252F1.12.0%252Fjquery.min.js%253A2%253A30370%250A%0AG%2F%3C%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A6%3A416%0Ag%2F%3C%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A38%3A391%0An%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A7%3A333%0Ag%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A37%3A489%0Ag%2F%3C%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A38%3A134%0An%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A7%3A333%0Ag%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A37%3A489%0Aeb%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A41%3A249%0Ac%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A19%3A463%0Ayc%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A20%3A274%0AZd%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A19%3A83%0A%40http%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fangularjs%2F1.4.8%2Fangular.min.js%3A294%3A194%0Ai%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.12.0%2Fjquery.min.js%3A2%3A27451%0AfireWith%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.12.0%2Fjquery.min.js%3A2%3A28215%0Aready%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.12.0%2Fjquery.min.js%3A2%3A30008%0AK%40https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.12.0%2Fjquery.min.js%3A2%3A30370%0A
Test ran successfully
1577811955704 Marionette INFO Stopped listening on port 50775
[Child 4984, Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1575282935/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
[Child 3244, Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1575282935/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
[Child 3244, Chrome_ChildThread] WARNING: pipe error: 1[Parent 6700, Gecko_IOThread] WARNING: pipe error: 109: file z:/task_1575282935/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
[Child 5488, Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1575282935/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
[GPU 7796, Chrome_ChildThread] WARNING: pipe error: 109: fi
Okay IE usually has some issues while automation. As of now I do not have much inputs here. Will let you know if I get something online.
@@RaghavPal sure Raghav and thx again !👍
How to do the same using python script?
Hi Spurthi, you can check Selenium Python tutorials here - automationstepbystep.com/
When I try to use Desired capabilities, I got this message "The constructor InternetExplorerDriver(Capabilities) is deprecated"
In IE Browser, displays "This is the initial start page for the WebDriver server." only
Hi Raghavendra, Use
InternetExplorerDriverService, InternetExplorerOptions
if you see the documentation its mentioned
@Deprecated
public InternetExplorerDriver(InternetExplorerDriverService service,
Capabilities capabilities)
Deprecated. Use InternetExplorerDriver(InternetExplorerDriverService, InternetExplorerOptions)
www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/ie/InternetExplorerDriver.html#InternetExplorerDriver-org.openqa.selenium.Capabilities-
@@RaghavPal thank you bro
I struggled with the IE for a long time, it can't findElement of search input in google. In console written SCRIPT5: Access is denied. Try to use InternetExplorerOptions with different capabilities but no fix. Google also didn't help. So to not lose more time, I just skip the lesson.
No issues Arsen, you can skip and continue with other browsers.
How to validate a image on right side of the page. Suppose a image is in right side.
Hi Rajat,
For your case, this will help
www.maisasolutions.com/blog/How-o-get-X-Y-coordinates-of-element-in-Selenium-WebDriver
stackoverflow.com/questions/21888317/how-to-verify-the-position-of-the-web-page-element
In case you want to do any visual validation, you can use Applitools, I have a video in the playlist -
th-cam.com/play/PLhW3qG5bs-L8oRay6qeS70vJYZ3SBQnFa.html
Rajat, in live session you asked for the links. I was referring to this comment
why we need this
prons and cons selwnium
this is handy to setup configurations or setup as we need
@@RaghavPal
configration means
any setup or values to be used based on some condition or env
HI ..
Same is Not working with Chrome browser
Hi Naveen, will need to see the code and error logs
Internet Explorer slow forever
Hi Sameer, yes automation with IE is not that smooth
:)