WaitForLogoutButtonAvailable.tstest.vb: Line 81: (BC30491) Expression does not produce a value.
This is the VB sub:
Public Sub WaitForLogoutButtonAvailable_CodedStep()
Dim found As Integer = 0
Dim s As HtmlSpan = Find.ByExpression(Of HtmlSpan)("textcontent=~logout")
While found = 0
If (Assert.IsNotNull(s)) Then
'Stop looking
found = 1
Else
'Wait for '250' msec.
System.Threading.Thread.Sleep(250)
End If
End While
End Sub
I tried exchanging the statement:
If (Assert.IsNotNull(s)) Then
for:
If (Assert.IsNotNull(s) = true) Then
but I get the same result. I also tried with various speechamrks, 1's and 0's. I read the on-line documentation (http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/write-tests-in-code/intermediate-topics/html-control-suite/html-asserts.aspx, and also http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/write-tests-in-code/intermediate-topics/element-identification/findparam-objects.aspx) but the pages don't actually show me what is returned by the assert.
Where am I going wrong?
Thanks,
Nigel Edwards, Transition Computing
I have the following code that searches a table that can be indexed by pages. What I do not know what is the return value of myTable.Find.ByContent when the search string is not matched. Also what’s a slick way to do an index search in the pages till the string is found. I want to mimic what a user would do in index.
Thanks,
John
Dim MySearchString as StringMySearchString = "Start All over III"' Copy the table into a local variable to make it easier to work withDim myTable As HtmlTable = Pages.JointCommissionResources9.CphTracerPageRadMyOrgTracesTable' Locate the row we want using text content (Enter the String to search byDim row As HtmlTableRow = myTable.Find.ByContent(Of HtmlTableCell)(MySearchString).Parent(Of HtmlTableRow)()' Locate the delete icon (which is going to be just an anchor tag) located in the third column of the current row'Dim link As HtmlAnchor = row.Cells(5).Find.ByExpression(Of HtmlAnchor)("uniquename=UrgbtnEditResponse")'uniquename="UrgbtnNewResponse"Dim link As HtmlAnchor = row.Cells(5).Find.ByExpression(Of HtmlAnchor)("uniquename=UrgbtnNewResponse")'Dim link As HtmlAnchor = row.Cells(4).Find.ByExpression(Of HtmlAnchor)("value=Print/Preview")' Now that we've found it, click the delete iconlink.Click()HtmlTableCell Find By Search StringDim MySearchString As StringDim PageNumber As IntegerMySearchString = "this is a new tracer"Log.WriteLine("Value: " & MySearchString)Log.WriteLine("Pages: " & GetExtractedValue("x2StrongTag").ToString())' Copy the table into a local variable to make it easier to work withDim myTable As HtmlTable = Pages.JointCommissionResources9.CphTracerPageRadMyOrgTracesTableLog.WriteLine("Table when Nothing found: " & myTable.ToString)' Locate the row we want using text content (Enter the String to search by'Dim row As HtmlTableRow = myTable.Find.ByContent(Of HtmlTableCell)("Article B01").Parent(Of HtmlTableRow)()Dim row As HtmlTableRow = myTable.Find.ByContent(Of HtmlTableCell)(MySearchString).Parent(Of HtmlTableRow)()' Locate the delete icon (which is going to be just an anchor tag) located in the third column of the current row'Dim link As HtmlAnchor = row.Cells(5).Find.ByExpression(Of HtmlAnchor)("uniquename=UrgbtnEditResponse")'uniquename="UrgbtnNewResponse"Dim link As HtmlAnchor = row.Cells(5).Find.ByExpression(Of HtmlAnchor)("uniquename=UrgbtnNewResponse")'Dim link As HtmlAnchor = row.Cells(4).Find.ByExpression(Of HtmlAnchor)("value=Print/Preview")' Now that we've found it, click the delete iconlink.Click()Hi,
I need help to find and identify screen objects whose name changes.
Specific Scenario Example
I have a screen with a Logout button. The visible text on the button is 'Logout ' plus the name of the logged on user (e.g. 'Logout Admin'). When I record the action of clicking on the button in Test Studio the script supplies a line that reads:
Click 'LogoutSpan'
or
Click 'LogoutSpan0'
or similar.
Question
How can I script so that the action works regardless of any number that may be appended to the 'LogoutSpan' part?
In fact, how can I identify anything (e.g. a 'Div') where its name or ID changes dynamically?
I thought that maybe some VB in the Code Behind window would be a solution, perhaps using a regular expression. In the case of the button I came up with:
Find.ByExpression("name=~Logout")
which I think will find any screen object with 'Logout' in its name, but got no further. I tried to write an excution line, something like:
Button.Click(Find.ByExpression("name=~Logout"))
but the type-ahead prompt in the Code Behind window didn't have 'Button.Click' as an option.
I'm not a code wizard, and don't really understand regular expressions (and yes, I've read the available on-line documentation) so I would very much appreciate some help with this. If I have a concrete example of how to resolve the above then I can build on it for the future.
Thanks,
Nigel Edwards, Transition Computing.
public ArtOfTest.WebAii.Controls.HtmlControls.HtmlAnchor Link_Contacts{ get { return Get<ArtOfTest.WebAii.Controls.HtmlControls.HtmlAnchor>("class=ms-crm-NavBar-Subarea-Link", "title=Contacts"); }}