Hi Team,
We are migrating Internet Explorer to Edge in Telerik C# framework.
We are changing BrowserType.InternetExplorer to BrowserType.MicrosoftEdge. But we are getting error like
Message:
Microsoft WebDriver is not installed! You can download it from here: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/.
Stack Trace:
ArtOfTest.WebAii.BrowserSpecialized.MicrosoftEdge.WebDriverException: Microsoft WebDriver is not installed! You can download it from here: https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/.
EdgeActions.LaunchNewBrowserInstance(ProcessWindowStyle windowStyle, Manager manager).
But we are able to launch browser using EdgeChromiium and Chrome.
For EdgeChromium and Chrome, works only on adding Progress Telerik Test Studio Extension.
Is there any ways to avoid adding extension from chrome store. and Edge browser works like IE?
Kindly suggest?
1 Answer, 1 is accepted
Hi Saranya,
The correct browser type to use for running tests in Edge is EdgeChromium. The one you have tried is the browser type for the initial versions of Edge, which are deprecated already.
Currently you can run tests in Chrome without extension. We are working on implementing this for Edge as well and this will be available in the upcoming releases of Test Studio.
To enable Chrome to run tests without extension you need to set the UseBrowserExtension property to false in the Settings.WebSettings class.
this.Manager.Settings.Web.UseBrowserExtension = false;
Please, give this a try and let me know if that works for you.
Regards,
Elena
Progress Telerik
Coming to you live from Progress360 in-person or on your own time, DevReach for all. Register Today.
Hi
With Extension in Edge ,it is working on Giving BrowserType.EdgeChromium in Visual Studio 2019.
But i cannot see the settings.web.usebrowserextension =false in Telerik framework settings for Chrome.
I am using Telerik 2021 version.
Even in Regedit, i added the Microsoftwebdriver.exe path under Telerik- HKEY.
Also, when same code i m running from Jenkins. It is giving,
ArtofTest.webaii.EdgeChromium Launchnewbrowser instance error.
System.TypeInitializationException: The type initializer for |'ArtOfTest.WebAii.Messaging.Process.ExecutionMediator|' threw an exception.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at ArtOfTest.WebAii.WebExtensions.StartPageProviderFactory.StartPageProviderFactory.RegisterProviders()
at ArtOfTest.WebAii.WebExtensions.StartPageProviderFactory.StartPageProviderFactory..ctor()
at ArtOfTest.WebAii.Messaging.Process.ExecutionMediator..ctor()
at ArtOfTest.WebAii.Messaging.Process.ExecutionMediator..cctor()
--- End of inner exception stack trace ---
at ArtOfTest.WebAii.BrowserSpecialized.EdgeChromium.EdgeChromiumActions.LaunchNewBrowserInstance(ProcessWindowStyle windowStyle, Manager manager)
at ArtOfTest.WebAii.Core.Manager.LaunchNewBrowser(BrowserType browserToLaunch, Boolean waitForBrowserToConnect, ProcessWindowStyle windowStyle, String arguments)
at ArtOfTest.WebAii.Core.Manager.LaunchNewBrowser()
Please help.
I tried all combinations
Hi Saranya,
Usebrowserextension setting
The option to execute tests in Chrome without extension was released at the beginning of this year. Since you are using a previous version of the Testing Framework this setting will not be available unless you upgrade to the latest available version of the Telerik Testing Framework.
MicrosoftWebDriver
This component was required for automating the legacy version of Edge browser, which is already deprecated. Having that said and from Telerik Testing Framework perspective you don't need to add the WebDriver in any way.
Jenkins environment
What version of the Testing Framework you are using on the Jenkins machine? What version of Edge is installed on that machine? Have you added the extension? Are you able to run the tests if using Chrome in this environment?
Summary
As far as I understand you managed to run the tests in Edge on your local machine, so that issue is resolved. Let me know if we need to focus on this further.
Thank you for your time and cooperation in advance.
Hi Team,
We have migrated IE to edge Browser in telerik. WE are running test cases in IE compatibility mode in Edge Browser.
But we are facing issue in login page with below error.
Wait for condition has timed out
Stack Trace:
System.TimeoutException: Wait for condition has timed out
WaitSync.CheckResult(WaitSync wait, String extraExceptionInfo, Object target)
WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout, WaitResultType errorResultType)
WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout)
Browser.WaitUntilReady()
Browser.ExecuteCommand(BrowserCommand request, Boolean performDomRefresh, Boolean waitUntilReady)
Browser.ExecuteCommand(BrowserCommand request)
Browser.InternalNavigateTo(Uri uri, Boolean useDecodedUrl)
Browser.NavigateTo(Uri uri, Boolean useDecodedUrl)
Browser.NavigateTo(String url, Boolean useDecodedUrl)
BrowserPool.NavigateTo(String url) line 101
BrowserPool.OpenBrowser(String url) line 20
<.ctor>b__13_0() line 37.
Kindly help
Hi Saranya,
I am glad to hear that you managed to setup running tests in Edge with the latest Testing Framework.
As to the compatibility mode in Edge - this ia not supported in Test Studio. Actually Internet Explorer is still one of the supported browser for automation in Test Studio and you can use it directly for both test recording and execution for the legacy application you maintain.
I do understand that the latest Windows version do not deply IE, however there are still OS platforms on which you can use this browser, although it soon gets out of support completely. You can check this blog post from Microsoft about the future of Internet Explorer browser - in it you can also find a list of platforms, for which the IE desktop application will remain in place.
Having that said, fom Test Studio perspective you can continue using IE for testing the specific application, but you need to keep a dedicated environment for the legacy page under test.
I hope this information helps you find the best approach to setup your automation project.
Let me know in case of any questions.
Regards,
Elena
Hi Team,
We wanted to highlight that Windows alert click /popups not working in Edge Chromium/Chrome.
We tried DialogMonitor but no luck. This Worked with IE but not in Edge.
Also i tried to press Enter key using Manager.Desktop.Keypress. still no luck. please can you help.
Also getting this Timeout 120201 exceeded while waiting for Save notification bar. Please help on this
Regards
Saranya
Hi Saranya,
Please, ensure that Edge and Chrome browsers are calibrated - you can check the necessary settings when you expand the Manual Configuration section at the bottom of this article for Chrome, and for Edge.
Also we released a new version of Test Studio and the Testing Framework yesterday - please, take the time to upgrade your current version as this latest version certainly supports the latest browsers dialogs.
Then, if you still face troubles with the dialogs, send me the code used to handle the dialogs.
Thank you for your cooperation in advance.
Regards,
Elena
Hello Elena,
public static void ActionConfirmHandle(Action action, DialogButton button, bool waitHandling)
{
DialogMonitoring.InitConfirmDialog(button);
DialogMonitoring.StartMonitoring();
action();
if (waitHandling)
DialogMonitoring.WaitForConfirmToComplete();
DialogMonitoring.StopMonitoring();
}
public static void ClickConfirmHandle(this HtmlControl element, DialogButton button = DialogButton.OK, bool useMouseClick = true)
{
if (useMouseClick)
ActionConfirmHandle(() =>
{
element.ScrollToVisible();
element.Focus();
element.MouseClick();
}, button, true);
else
ActionConfirmHandle(() => element.Click(true), button, true);
}
I am using the above code. can you please help. i upgraded to 2022 telerik. still it couldnt handle the dialog.
Please help
Hi Saranya,
The structure of dialogs in browser change very dynamically and we update our logic to handle the new version of dialogs. You need to use the available objects and methods in the Telerik Testing Framework API. Please review the links below.
- DialogMonitor.
- AlertDialog - full alert dialog example.
- DownloadDialogHandler - full download dialog example.
I noticed that you code is different and it might have worked before with specific version of the execution browser, or IE/Microsoft Edge. Based on the provided information, you need to adjust your code to use those methods.
Let me know if you continue to experience any troubles with this scenario after that. Prepare a sample code that runs against publicly accessible application, so I can run it on my end, explore it and advise you further.
Regards,
Elena
Hello Team,
Tried all the ways for pop up issue. attached sample code with all methods we tried. no luck . kindly help.
Please provide us the code to handle pop up in Edge or Chrome browser 2022 telerik
Regards
Saranya
Hello Saranya,
I checked the sample test and there is one note about it, which will fix the issue.
The alert dialog needs to be added to the collection and the DialogMonitor needs to be started, before you trigger the AlertDialog to popup. In our example, we trigger the dialog with JavaScript and that is why the InvokeScript method is last.
In your case and in the sample page, the click action corresponds to the JS event from the example and actually opens the AlertDialog. This means that you need to move the following part of the code, before that click action.
// As mentioned by Telerik team Manager.DialogMonitor.AddDialog(new AlertDialog(ActiveBrowser, DialogButton.OK)); // Given that there were not dialog attribute set, the manager will not start the monitoring. // You need to invoke the monitoring Manager.DialogMonitor.Start();
I tested this on my end and it is working as expected. Please take the time to review the above suggestion and apply it on your end.
Regards,
Elena
Hi Team,
Thanks for your help! Dialog and Download worked.
But we are facing new issue while downloading, some files like.xml extensions while downloading getting alert like ' Do you want to keep this file' Keep or discard
How to handle this .
Please help
Thanks
Hello Team,
I m facing one more issue with download. Download Dialog hanlder works fines if i want to download for the first time.
Same code doesnt work, if i try to downlaod additional files recurrently.
Attached screenshot for reference.
Hi Saranya,
I am glad to hear the download dialog works now as expected.
When it comes to the alert about keeping a file - this sounds like any sort of additional restrictions you have on your computer. This dialog is not part of the download process, it is a verification from the browser based on the file type. Please make sure that the browser you are using is calibrated before running the test with download dialog. If that does not help with the unexpected dialog, check the browser's settings to allow the download of .XML files or for file validation. Alternatively, you can try to add an alert or confirm dialogs to the DialogMonitor and check if that will handle the new dialog from the browser.
Downloading multiple files one after the other supposes to add a dialog to the DialogMonitor for each dialog you expect to handle. That means if you download two files, you need to define two dialog handlers for each of these. Is this how you set the actions for that scenario?
In case you need additional assistance on this topic, prepare a sample test, which demonstrates the misbehavior you observe.
Thank you for your understanding and cooperation.
Regards,
Elena
Hi ,
Thanks i will try it.
Can you help me how to get the text from the Alert pop up in Chrome or edge.
Regards
Saranya
Hi Saranya,
Verifying the dialog text is not supported in Test Studio out of the box. Also I have to admit that this could be quite tricky because dialogs are being subject of change in almost each next update of the browsers.
You can use this sample article as a baseline, but need to keep in mind that it was created for certain version of the browser and fits the dialog structure for that version. However, it probably needs to be adjusted for the dialog in its current structure.
Regards,
Elena
Hi Elena,
Downloading single file is not an issue. with below code i can do it.
The file downloading successfully.
public static void ClickAndDownload(this HtmlControl element, string fullTargetFileName, bool useButtonClick = false)
{
File.Delete(fullTargetFileName);
if (useButtonClick)
element.ButtonClick();
else
element.Click(true);
BrowserPool.WaitUntilPageLoaded();
//telerik 2022 changes
DownloadDialogsHandler ddialog = new DownloadDialogsHandler(Manager.Current.ActiveBrowser, DialogButton.SAVE, fullTargetFileName, Manager.Current.Desktop);
Thread.Sleep(30000);
Manager.Current.DialogMonitor.Start();
BrowserPool.WaitUntilPageLoaded();
BrowserPool.ActiveBrowser.Desktop.KeyBoard.KeyDown(Keys.Alt);
Manager.Current.DialogMonitor.Stop();
}
But in same test case if i want to download one more file. then same code is not working. you can see the below pop up. the control doesnt go to the Save As button . how to hanlde it. i dont have any sample file . as my project is secured i cant share the credentials also. please help us on this. as many of our test cases depends on this scenario.
Hi Saranya,
If you want to download multiple files in the same test you need to remove the handled dialog from the DialogMonitor collection. In other words you need to insert the following line of code after the dialog is handled and before stopping the DialogMonitor (the argument of the method should be the name of the defined dialog):
Manager.DialogMonitor.RemoveDialog(ddialog);
On a side note I want to mention that based on the shared code snippet I don't see an action to add the defined dialog into the collection and an action to wait until this is handled. Therefore want to add that the expected workflow for handling a dialog is as follows:
- Define the dialog. FileUploadDialog defDialog = new FileUploadDialog(args); (the type of dialog is just an example)
- Add the dialog to the monitoring collection. Manager.DialogMonitor.AddDialog(defDialog);
- Start the dialog monitoring, Manager.DialogMonitor.Start();
- Insert an action to trigger the dialog.
- Wait until the dialog is handled. defDialog.WaitUntilHandled(10000);
- Remove the handled dialog from the collection. Manager.DialogMonitor.RemoveDialog(defDialog);
- Stop the dialog monitoring Manager.DialogMonitor.Stop();
I hope that these notes will be of further help for you. Let me know if you managed to setup the test to perform all required actions. In case you need additional assistance, I will appreciate if you can prepare a sample test to demonstrate the issue.
Thank you for your cooperation in advance.
Regards,
Elena
Hello Elena,
Thanks for your help. i changed my code for mulitple download files and working fine.
below is the code for mulitple file doownload.
DownloadDialogsHandler fileDownloadDialog = new DownloadDialogsHandler(element.OwnerBrowser, DialogButton.SAVE, fullTargetFileName, Manager.Current.Desktop);Manager.Current.DialogMonitor.Start();
element.MouseClick(MouseClickType.LeftClick);
Thread.Sleep(50000);
Manager.Current.DialogMonitor.Stop();
Manager.Current.DialogMonitor.RemoveDialogs();.
Hello Team,
I am not able to retreive the text from the windows alert in Edge or chrome browser. I tried using your sample code but no luck.
Verify Dialog Text In Chrome - Progress Test Studio (telerik.com)
This retrieves only the title of the pop up message box. For example it retreives only jabdwvc0556 says. but not the entire message.
This message comes on clicking upload button in the below page. The upload button uses Javascript onclick. I have attached two images with HTML backend for upload button and javascript function behind upload. can you please help on this
Hi Saranya,
I am glad to know you can now reuse the code to handle multiple dialogs one after the other in the same test.
As to your other query - let me remind you that the provided sample article is only the baseline to refer to when verifying the text in a dialog. It was built for certain version of the browser and the structure of dialogs in it. The structure of the browser dialogs are subject of change in almost each next version and also the location of the text may vary depending on the machine used for execution.
So, it's up to you to adjust that sample and keep it up-to-date with each next update or change of the execution machine.
Thank you for your understanding.
Regards,
Elena