This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Not able to fetch color/style of Web element .Getting error

I need to retrieve  a web element color  and trying below  code

Style stys=appModel.StPage().PlayButton().getNativeObject().getProperty("style", Style.class);
System.out.println(stys.getName());

But getting below exception. Please can someone help?

java.lang.ClassCastException: com.hp.lft.sdk.internal.DynamicObjectProxy cannot be cast to javax.swing.text.Style

Thanks

Devkant

  • Verified Answer

    +1

    I am able to solve the issue. Just to help others in case anyelse face same issue in future : 

    Style is again a native object so we need to do following to get color and other style properties

    NativeObject styleNativeObject =appModel.SagtPage().MessNumberPlayButton().getNativeObject().getProperty("style", NativeObject.class);
    System.out.println("Button Color is ::"+styleNativeObject.getProperty("color", String.class));