Telerik Forums
Test Studio Forum
1 answer
6 views

Hello, 

I'm using the connect to popup dialog to connect to a browser that is launched when clicking a link. I then do some actions in the second  tab which changes the URL, I then need to close the second browser, do I use the close popup dialog to close the second tab and just put the now chanced URL or do I use the URL I connected to. Right now I put the modified url in the close popup dialog, but sometimes it doesn't close the new browser tab and shift focus back to the first browser tab. 

I'm aware I can use a coded step to close that second tab, and use Manager.Browsers.count to count the tabs to ensure that second tab does close as long as I do a global browser count variable. If you believe that's the best way to go I can do that, but I wanted to make sure I was approaching it correctly.

Plamen Mitrev
Telerik team
 answered on 07 May 2021
1 answer
2 views

Hello,

I have created a test to log in via Azure Active Directory using Data Driven steps that get the login from XML file. 

I have ensured that all credentials are correct.

When I execute the test to log in, it shows this error (picture attached). But when I click the Next Button manually it works and goes to the next page (password page).  Any Ideas why it wouldn't work on the test but does work manually?

Kind regards,

Bella

Elena
Telerik team
 answered on 06 May 2021
1 answer
5 views

Hi,

We are using Telerik Test Studio 2017.1.207.0 and we implement custom DLL to launch or close our application.

Regularly, when calling the methods included in that code, the Test Freeze and nothing is done. I am putting the code below.

The problem concerns the call but not our code itself.

Currently the code is compiled in Debug / AnyCPU. Do you advise to compile that code in Debug or in Release mode ?

Is this problem known and is there a workaround ?

Is this problem fixed in latest version ?

Thanks in advance,

Best regards.

using System.Text;
using System.Threading.Tasks;

namespace Common
{
    public class Utility
    {
        public static void StartCustomApp(Manager manager, ExecutionContext executionContext, string customAppPath, string args = "", int waitForWindow = 10000, int waitingTime = 10000)
        {
            Assert.IsNotNull(manager, $"Manager is null.");

            manager.ActiveApplication.MainWindow.Window.Minimize();
            manager.ActiveApplication.Detach(false);
            var executablePath = executionContext.DeploymentDirectory + customAppPath;

            Assert.IsTrue(File.Exists(executablePath), $"Can not found {customAppPath} path.");

            var appName = Path.GetFileNameWithoutExtension(customAppPath);

            // Prepare the process to run
            ProcessStartInfo app = new ProcessStartInfo();
            app.Arguments = args;
            app.FileName = executablePath;        

            Assert.IsNotNull(manager.LaunchNewApplication(app), $"Failed to connect to {appName}.");

            manager.ActiveApplication.WaitForWindow($"~{appName}", waitForWindow);

            System.Threading.Thread.Sleep(waitingTime);

            manager.ActiveApplication.MainWindow.SetWindowFocus();
            manager.ActiveApplication.MainWindow.Window.Maximize();
            manager.ActiveApplication.MainWindow.RefreshVisualTrees();
        }

        public static void connectToApp(Manager manager, string appName, bool closeAppOnDetach = false)
        {
            manager.Log.WriteLine(DateTime.Now.ToString()+" - Start connectToApp"+appName);
            Assert.IsNotNull(manager, $"Manager is null.");

            Assert.IsNotNull(manager.ActiveApplication, $"ActiveApplication is null.");

            manager.Log.WriteLine(DateTime.Now.ToString() + " - detach previous App");
            manager.ActiveApplication.Detach(closeAppOnDetach);

            var proc = Process.GetProcesses().Where(p => p.ProcessName.Contains(appName)).FirstOrDefault();

            Assert.IsNotNull(proc, $"{appName} is not running.");

            manager.Log.WriteLine(DateTime.Now.ToString() + " - connect to App " + appName);
            Assert.IsNotNull(manager.ConnectToApplication(proc), $"Failed to connect to {appName}.");

            manager.ActiveApplication.MainWindow.Window.SetFocus();
            manager.ActiveApplication.MainWindow.Window.SetActive();
            manager.ActiveApplication.MainWindow.Window.Maximize();
            manager.ActiveApplication.MainWindow.RefreshVisualTrees();
        }

        public static void CloseApp(string appName)
        {
            var runningApp = System.Diagnostics.Process.GetProcesses().Where(p => p.ProcessName.Contains(appName));
            string executablePath = string.Empty;

            if (runningApp.Count() > 0)
            {
                foreach (var process in runningApp)
                    process.Kill();
            }
        }
    }
}

Elena
Telerik team
 answered on 04 May 2021
1 answer
3 views

Hi,

We bought few years ago the Tekerik Test Studio 2017.1.207.0.

When we run tests, and application windows or popup are closed, we frequently have the message :

Failure Information:
~~~~~~~~~~~~~~~
Collection was modified; enumeration operation may not execute.
InnerException:
System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at System.Collections.Generic.List`1.Enumerator.MoveNext()
   at System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at ArtOfTest.WebAii.Core.Manager.get_ActiveWpfWindow()
   at ArtOfTest.WebAii.Design.Execution.ExecutionEngine.ExecuteStep(Int32 order)

We tried to add a wait command after the close but it does not succeeded.

Is there a workaround to bypass this bug ?

Is this bug fixed in latest version ?

Thanks in advance,

Best regards.

Elena
Telerik team
 answered on 04 May 2021
1 answer
5 views

I am trying to open our web site which is located abroad so there is a considerable delay between request and response. Sometimes it takes up to 10-15 seconds to load the page and while waiting for it Test studio is throwing the following error (but after all it loads the page though):

 

'30/04/2021 14:46:42' - 'Fail' : 6. Navigate to : eHarmony by NavigateURL variable
------------------------------------------------------------
Failure Information: 
~~~~~~~~~~~~~~~
Exception thrown executing coded step: 'Navigate to : eHarmony by NavigateURL variable'.
InnerException:
System.TimeoutException: Wait for condition has timed out
   at ArtOfTest.Common.WaitSync.CheckResult(WaitSync wait, String extraExceptionInfo, Object target)
   at ArtOfTest.Common.WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout, WaitResultType errorResultType)
   at ArtOfTest.Common.WaitSync.For[T](Predicate`1 predicate, T target, Boolean invertCondition, Int32 timeout)
   at ArtOfTest.WebAii.Core.Browser.WaitUntilReady()
   at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request, Boolean performDomRefresh, Boolean waitUntilReady)
   at ArtOfTest.WebAii.Core.Browser.ExecuteCommand(BrowserCommand request)
   at ArtOfTest.WebAii.Core.Browser.InternalNavigateTo(Uri uri, Boolean useDecodedUrl)
   at ArtOfTest.WebAii.Core.Browser.NavigateTo(Uri uri, Boolean useDecodedUrl)
   at ArtOfTest.WebAii.Core.Browser.NavigateTo(String url, Boolean useDecodedUrl)
   at UpdateIdkynScreenFull.YN_GeneralManagerLoginProduction.YN_General_Manager_Login__CodedStep2() in c:\Automate\ATP%20Sources\eHarmonySecurity11\Logins\YN- General Manager Login .tstest.cs:line 111
------------------------------------------------------------

 

Has someone faced this issue and how could you handle this, please? I know that I can put "continue on failure"=true, but then the overall result of the test will be shown as failed

Plamen Mitrev
Telerik team
 answered on 03 May 2021
1 answer
5 views

Hi Team,

I am getting error while executing Rest API for authentication. This works fine on fiddler but does not work on Telerik Test studio API. Please help! 

I have attached a code and screenshot. 

Error: 

'The request was aborted: The request was canceled.'

Thank you so much in advance.

Elena
Telerik team
 answered on 22 Apr 2021
1 answer
4 views

Hi,

I am new to Telerik Test Studio.

I am trying to figure out how to find a label if it's pseudo element ::before or ::after contains specific CSS class (.custom-control-input:checked).

Please see the screenshot attached.

If I locate required element as below:

var label = div.Find.ByAttributes<HtmlControl>("class=~custom-control-label");

I can't find the way to examine its pseudo elements. There is no trace of .custom-control-input:checked

Please advise

Elena
Telerik team
 answered on 21 Apr 2021
5 answers
25 views

Hello,

Recently I get this error when filling in something in a textbox in chrome. Does anybody have a glue why and how to solve this.

ExecuteCommand failed!
InError set by the client. Client Error:
Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src https: 'unsafe-inline'".

BrowserCommand (Type:'Action',Info:'NotSet',Action:'InvokeJsFunction',Target:'ElementId (tagName: '',occurrenceIndex: '-1')',Data:'document.getElementsByTagName('input')[0].focus()',ClientId:'e0aa945a-25fb-49b3-83a5-e4b7da4f60bb',HasFrames:'False',FramesInfo:'',TargetFrameIndex:'-1',InError:'True',Response:'Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src https: 'unsafe-inline'".
')
InnerException: none.

Thanks
Bjorn

Elena
Telerik team
 answered on 15 Apr 2021
8 answers
7 views

Is it possible to make a custom coded testing step that iterates the current webpage DOM, finds all of the date fields and types in a date?

 

I am a C# coder but not that familiar with the object model of test studio so I could use a little starter code.

 

Thanks!

Plamen Mitrev
Telerik team
 answered on 15 Apr 2021
5 answers
7 views

Hi Guys,

I am getting this error when I run convert recorded steps to Code.

Please refer video.

 

Code :

  Actions.SetText(Pages.Time2Work.TbUsernameEmail, "AutoCycle");

 

Failure Information: 
~~~~~~~~~~~~~~~
Exception thrown executing coded step: 'Enter text 'AutoCycle' in 'TbUsernameEmail''.
InnerException:
System.ArgumentException: Invalid input type 'Text' for this control. Control was expecting 'Email'
   at ArtOfTest.WebAii.Controls.Control.CreateInstance[TControl](Element e, Boolean throwIfNull)
   at ArtOfTest.WebAii.ObjectModel.Element.As[TControl]()
   at ArtOfTest.WebAii.TestTemplates.HtmlElementContainer.Get[TControl](HtmlFindExpression expr)
   at ArtOfTest.WebAii.TestTemplates.HtmlElementContainer.Get[TControl](String[] clauses)
   at WebTest.Pages.Time2WorkPage.get_TbUsernameEmail() in c:\Dev\OnTime\Scheduler\WebTests\System Regression\Pages.g.cs:line 364
   at WebTest.Login_Employee_User.Login_Employee_User_CodedStep3() in c:\Dev\OnTime\Scheduler\WebTests\System Regression\03_User Tests\Login Employee User.tstest.cs:line 148
Plamen Mitrev
Telerik team
 answered on 14 Apr 2021