Quantcast
Channel: Silk Test - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 625

SilkTest Can not click on sub menu item

$
0
0

Issue:

Silk test fails to play back and click on sub menu item with the error " Could not find object", the sub menu item can only be made clickable if the parent menu item is is rolled over 1st with the mouse. In other automation testing tools, e.g. Sahi, the link can be clicked without the need to "roll over" the parent menu item.

The same error also occurred when the object is visible on the page.

SilkTest sometimes creates second Browser window object when it does not need to with the same BrowserApplication name (as seen in recorded code below). This also causes playback to fail in some of our other test scripts we have been evaluating.

Does anyone know a work around to recording/playback clicking a sub menu item without having write a whole bunch of code to replace the recorded code and to stop SilkTest creating lots of unnecessary browser window objects?

Thanks.

 

 

Scenario: record these steps using Visual Studio 2015 C# with Silk Test 17.0:

Steps:

Navigate to "https://www.microsoft.com/en-gb/" > left click "Store" > roll mouse over "Devices" > left click "PCs & tablets" > observe

----

Playback:

Actual Result: Silk test fails to playback and displays and error: Could not find object '//a[@textContents='PCs & tablets']'.

Expected Result: PCs & tablets web page is displayed

Observations: A BrowserWindow object is created when it does not need to be.

----

Recorded Code generate by silk test in pink:

using System;

using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SilkTest.Ntf;
using SilkTest.Ntf.XBrowser;

namespace Silk4NETProject1.Keyword_Driven_Tests
{
[SilkTestClass]
public class UnitTest1
{
private readonly Desktop _desktop = Agent.Desktop;

[TestInitialize]
public void Initialize()
{
// Go to web page 'https://www.microsoft.com/en-gb/'
BrowserBaseState baseState = new BrowserBaseState();
baseState.Execute();
}


//
[TestMethod]
public void TestMethod1()
{

BrowserApplication webBrowser = _desktop.BrowserApplication("microsoft_com");
BrowserWindow browserWindow = webBrowser.BrowserWindow("BrowserWindow");
browserWindow.DomLink("Store-navigation").Click(MouseButton.Left, new Point(57, 22));

BrowserApplication webBrowser2 = _desktop.BrowserApplication("microsoftstore_com");
BrowserWindow browserWindow2 = webBrowser2.BrowserWindow("BrowserWindow");

//here is where it fails
browserWindow2.DomLink("PCs & tablets").Click(MouseButton.Left, new Point(85, 36));
//Actual Result: Could not find object '//a[@textContents='PCs & tablets']'.

}

}
}


Viewing all articles
Browse latest Browse all 625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>