You can translate the question and the replies:

Find Element by Beginning of ID or Name

Hello, I am trying to find an element which is a textbox by name or id. The last 5 digits of the ID and name change daily.(example below) I was wondering if there is a way to FindElement that starts with, or contains, or islike a certain phrase rather than exactly equal to. FindElementByXPath(//INPUT[\@name = "ctl00$cphPage$tcSearchMenu$tpNameSearch$txtDefendantFirstName_49053"]);
user
19-03-2015 15:43:41 -0400
code

3 Answers

Hi, XPath provides a "contains" function. For example: //INPUT[contains(@name,'ctl00$cphPage$tcSearchMenu$tpNameSearch$txtDefendantFirstName')]" Besides, there is a command family findElementByXXX that locates and selects an element in the current frame. Different location criteria can be used: element type, attribute values, content text, position,and xpath expressions. You have more information about these commands in section "3.5 COMMANDS FOR SELECTING FORMS" of "NSEQL Manual" Hope this helps!
Denodo Team
20-03-2015 07:16:43 -0400
code
Denodo Team, I am having a issue with your syntax. When I add in the line you stated to the Sequence Editor it is coming up Red meaning that there is a syntax issue. After reviewing "3.5 COMMANDS FOR SELECTING FORMS" of "NSEQL Manual" there was no information on how to find a element using "contains". Please help me with the current syntax of: FindElementByXPath(//INPUT[contains(@name,'ctl00$cphPage$tcSearchMenu$tpNameSearch$txtDefendantFirstName')]); Thank you
user
23-03-2015 15:53:00 -0400
Hi! You can use the function FindElementByAttribute described in the NSEQL Manual, section "COMMANDS FOR SELECTING ELEMENTS". This function has an attribute that indicates if the input parameter should exactly match the attribute value. The result should like this: FindElementByAttribute(INPUT,id,constant_value,0,false); Hope this helps!
Denodo Team
24-03-2015 06:35:27 -0400
code
You must sign in to add an answer. If you do not have an account, you can register here