How to convert string to By type

后端 未结 4 1783
春和景丽
春和景丽 2021-01-27 06:43

How to convert String to By type.

Following is my scenario: Keep object identification in Properties file in below manner

username=By.id(\"username\")
pa         


        
4条回答
  •  天命终不由人
    2021-01-27 07:31

    I think you are trying to implement page object model using properties file. What I would suggest here to use xml file instead of java properties file. for example sample xml for page elements would look like below.

    
    
        username
        password
    
    
    

    Now you can write methods retrieve nodes from the xml file and node attribute as id,xpath etc... further write methods to find elements using xml node value and attribute. I have used same method in my project as it works great for me.

提交回复
热议问题