Telerik Forums
Testing Framework Forum
4 answers
632 views
I've been automating tests for a specific website for some time now. I am using Testing Framework Version 2014.2.618.0 Free Edition with c# for chrome browser.
I am having trouble getting an iFrame element and elements within it from one of the pages.
Html structure is the following:
<div id="rightContainer" role="main">
<section class="application-plugin using-bootstrap"></section>
<iframe scrolling="no" allowtransparency="true" class="application-plugin-iframe" allowfullscreen="true" style="width: 100%; overflow: hidden; height: 928px;" src="http://plugins/application...">
#document
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body>
<div id="PluginTarget" "></div>
<div class="plugin-landing-page ">
<div class="plugin-landing-page-tiles clearfix ">
::before
<div class="col-md-4 col-sm-4 plugin-program-container ">
<div class="plugin-program "></div>//I want to click at this element
</div>
<div class="col-md-4 col-sm-4 plugin-program-container ">...</div>
</div>  
</body>
</html>
</iframe>                                 
</section>
<div style="display:none; "></div>
</div>


Note that ‘#document’ is a shadow DOM element.
What I tried so far to access the iFrame:
1)
Manager.ActiveBrowser.Frames.RefreshAllDomTrees();
Manager.ActiveBrowser.RefreshDomTree();
Manager.ActiveBrowser.Frames.WaitAllUntilReady();
int framesNumber = Manager.ActiveBrowser.Frames.Count;
Browser topFrame = Browser.Manager.ActiveBrowser.Frames["application-plugin-iframe"];
topFrame.RefreshDomTree();

topFrame is always null no matter how many times and in what sequence I’ve refreshed.
framesNumber is always null too.

2)

var topFrame = Manager.ActiveBrowser.Find.ByAttributes<HtmlControl>(string.Format("{0}={1}", "class", "application-plugin-iframe"));
Predicate<HtmlControl> filter = new Predicate<HtmlControl>((control) => control.Attributes.Any(a => a.Name == "class=" && a.Value=="plugin-program"));
var myBox =topFrame.Find.ByCustom<HtmlControl>(filter);

Using this approach I’m able to get the iFrame as HtmlControl or HtmlContainerControl element but myBox element is always null.

3)

var iFrame1 = Browser.Find.ByExpression("tagname=iframe");
var iFrameHtmlControl = new HtmlControl (iFrame1);
IUiSearchable searchable = new SearchableUiContext<HtmlControl>(iFrameHtmlControl);
searchable.Refresh();
HtmlControl result = searchable.Find.ByAttributes<HtmlControl>(string.Format("{0}={1}", "class", "plugin-program"));

Here again I’m able to get iFrame1 and iFrameHtmlControl elements and to Refresh but result is again null
4)
I tried getting the iframe
var topFrame = Manager.ActiveBrowser.Find.ByAttributes<HtmlControl>(string.Format("{0}={1}", "class", "application-plugin-iframe"));

And then getting all its child elements with a recursive method which is basically doing
allSubElements.AddRange(start.ChildNodes);
 for each child
I always get just one child element for topFrame - the Shadow DOM which doesn’t have children so here I figured out that the Shadow DOM element could be the cause of my problems but I’m not sure.

5)

Manager.ActiveBrowser.Actions.InvokeScript("$('body /deep/ #PluginTarget .plugin-program.click();");

This script worked when executed in Chrome Browser console but I need to click inside the Shadow DOM before. I still can’t do that from the test so executing JavaScript to click the desired element also failed.

As you can see I'm running out of ideas for this issue which is quite frustrating. Since the main logic of my app reside in that iFrame not being able to operate with it is a true deal breaker for me. 

Thank you in advance for any help.

Kind regards,

Elena
Telerik team
 answered on 10 Aug 2016
1 answer
111 views

I am facing an issue with Htmlspan clicking over a Menu Item. The issue is if I am using the below code (for example) it is working fine

 

HtmlSpan menu = manager.ActiveBrowser.Find.ByExpression<HtmlSpan>("tagname=span", "TextContent=~Management Process");

menu.Click(false);

 

But, when I am using this code it is not working

HtmlSpan menu = manager.ActiveBrowser.Find.ByExpression<HtmlSpan>("tagname=span", "TextContent=Management Process Dynamic");
menu.Click(false);

I am not able to understand why the exact TextContext is not working, I can't rely on the partial one, because multiple menu items can start with the same name (not now but may be in future). Please let me know if I need to change the Find Expression or I am missing something.

 

Regards,

Arvind Dhiman

Elena
Telerik team
 answered on 04 Aug 2016
11 answers
210 views

Hi,

 

In my project I have two tests, one for 'Accounts' and another for 'Advanced Find'

The 'Accounts' test has a coded step..

    public void SelectAccountTypeByName(String typeName, Browser xframe)
        {

 

 

dan
Top achievements
Rank 1
 answered on 29 Jul 2016
1 answer
110 views

I would like to test a grid (ASP.NET) with batch editing by using testing framework. To trigger the batch editing function, a user activate this with the mouse up event. If I use MouseClick(MouseLeftClick) or MouseClick(MouseLeftUp), the editing was not activated. Thank you for your help.

Nikolay Petrov
Telerik team
 answered on 28 Jul 2016
38 answers
1.7K+ views
Hello:

I am automating an application which has majority of the controls build using KendoUI such as
KendoGrid
Kendo Temaplate etc


Can you please help me how to identify these controls such as Kendo Grid and proceed further.Also please let me know Telerik Test tsudio completely supports Kendo UI controls or not.If not then from which version of test studio can we expect a complete support.

Thanks,
Naga
Boyan Boev
Telerik team
 answered on 27 Jul 2016
4 answers
253 views

I'd like to run my tests on a different server. Therefore I copied my project .exe along with all the .dll files to my server and started to run it.

Seeing as Firefox doesn't have the Telerik Test Studio Automation extension installed on my server the test just hang.

Therefore I'd like to install the extension, however where exactly does one download the extension? It doesn't seem to be available in the Firefox addon store nor any place else.

 

So my question is, from where do I download the Telerik Test Studio Automation extension for Firefox?

Elena
Telerik team
 answered on 18 Jul 2016
38 answers
283 views
We are running Silverlight tests through NUnit on Internet Explorer and we have a test that works perfectly fine on most machines.

However we have one machine running windows 7 Enterprise which seems to just crash when it navigates to a page. We get a c++ runtime error (see attached) and the browser crashes. I have also attached a screenshot showing what runtimes we have installed.

I'm 100% sure its not our application as we can navigate to the page without issue outside the test but as soon as the framework tries to navigate to the page it has issues. It opens the browser without issue and then tries to navigate to the page as soon as the silverlight portion loads it just crashes and we get that error.

As this works fine on all our other machines (also windows 7) I'm guessing its some sort of configuration or set up/dependency issue. I've made sure its in a trused zone and security is low.

I have tried to re-install the Telerik framework (latest version) but it doesn't make any difference. Are there any security settings I should look out for?
Is there some sort of browser extension that gets installed that may be disabled ?

I'm really stuck so any ideas how to move forward are appreciated.

My next step will be to decompile the code and step through to see exactly what is breaking inside the framework, I'll post my findings in this thread.

Thanks
Boyan Boev
Telerik team
 answered on 15 Jul 2016
3 answers
120 views

Hello,

I have an automation suite that takes a long time to fully run. It mainly consists of test-cases that take 30s-4m on average, but all add up to 2.5 hours total. As I run the automation, I notice that parsing text from pages seems to get slower and slower and then at some point telerik can't access pages anymore and all InternetExplorer shows is this error:

"PRXY0007: The request or the response message was incomplete or malformed. An existing connection was forcibly closed by the remote host"

Is there a known reason why this would happen? How is it prevented?

Elena
Telerik team
 answered on 01 Jul 2016
5 answers
147 views

The code that is below is something that I quite frequently have to use in order to export data from my application and handle the overwrite box if it pops up. My issue is, I have to copy and paste this in every single new test that I do and make sure I change all the right values. What I would like to do is put this in a 'library' file so I can just access a single function call in each test that will handle all of this, instead of copying and changing ALL of this text every single time. This is in an attempt to make my project a little smaller, and make it easier to maintain and create.

 

However. The manager class, and call to the element to open the dialog handler are getting in my way to moving this into a separate class file. Does anybody know of a way I might be able to accomplish this?

 

GenericDialog genDialog = new GenericDialog(Manager.ActiveApplication, "Save As", false, 6);
SaveAsDialog saveDlg = SaveAsDialog.CreateSaveAsDialog(Manager.ActiveApplication, DialogButton.SAVE, queryFilePath);
Manager.DialogMonitor.AddDialog(saveDlg);
Manager.DialogMonitor.AddDialog(genDialog);
Manager.DialogMonitor.Start();
            
// Wait for '1000' msec.
// Handle the overwrite box on save.
Applications.dTIMSexe.dTIMS_V9_For_Windows.ExportAllTextblock.User.Click(ArtOfTest.WebAii.Core.MouseClickType.LeftClick, 23, 19, ArtOfTest.Common.OffsetReference.TopLeftCorner, ArtOfTest.Common.ActionPointUnitType.Percentage, ((System.Windows.Forms.Keys)(0)));
                    
saveDlg.WaitUntilHandled(60000);
Manager.DialogMonitor.Stop();
Manager.DialogMonitor.RemoveDialogs(saveDlg, genDialog);

Aaron
Top achievements
Rank 1
 answered on 24 Jun 2016
3 answers
76 views

Hello! Quick question regarding how data driven test structure works.

Let's pretend I have test A which logs into a website. Test B will now now use test A using 'test as a step' to get to the webpage and do additional things on the page.

Now let's say I want to want to use different accounts for test A to log into the website so test A is now data driven. However, the content on the website changes for each different account so if I turn test B data driven as well, I need to verify certain elements that correspond to the account that was used to log in.

If I follow this workflow however, and use data driven test A as a 'test step' inside test B, test A will run through all of it's data driven iterations before running anything in test B.

I want each the data for test A and B to be executed in tandem so the flow becomes:
log into account 1, verify on the website data belonging to account 1
log into account 2, verify on the website data belonging to account 1

How it currently works however, given my test flow, is:
log into account 1
log into account 2

verify on the website data belonging to account 1,

verify on the website data belonging to account 1

..which is not what I want. The only alternative I can think of is not using 'test as a step' to bypass the way the data driven logic is currently behaving. If there is any other way to switch up the order of how data driven tests work, please let me know, thanks!

 

Boyan Boev
Telerik team
 answered on 09 Jun 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?