0

Wanted to ask if anyone is aware about any implementation or pattern for Selenium WebElement interface to get "Logical Name" of any given WebElement object in Java.

I am looking for something like this:

@FindBy(xpath = "//tr[2]/td[@class='listrow1'][3]")
    private WebElement txtProvider;
    txtProvider.SetLogicalName = "Provider TextBox" 

assertEqualsSoft(txtProvider.getText(), hashMap.get(EMHashMapConst.PROVIDER), txtProvider.getLogicalName + strMsg);
Vlad
  • 121
  • 1
  • 2
  • 7

1 Answers1

0

You could probably do something similar through Reflection.

Java Reflection: How to get the name of a variable?

(edit: Before the revision of the question it wasn't totally clear that this was related to Selenium API property, I thought you were just looking for way of programatically ID'ing variable. If so, reflection is good to look into, as it is a generic programming practice.)

Community
  • 1
  • 1
jm0
  • 3,294
  • 2
  • 16
  • 18