Is it correct to write two annotations for the same element?

I have to test the same application implemented for both iOS and Android, but some of the keys located in localizable.strings and strings.xml are different… and I want to write a cross-platform test…just discovered that this works:

@iOSFindBy(id ="iOSButtonID")
private WebElement signIn;

If I run the test against Android app, it will use the “androidButtonID” and if I’ll run against iOS app it will use “iOSButtonID”.

Is that correct from the page objects point of view? :smile:
I’m thinking that if this is a correct approach, it would solve a lot regarding cross-platform tests whenever your keys are different.

Yeah! It is correct.
Also. If you run tests for web app which has the similar UI as Android/iOS versions you can define your locators this way:

@FindBy(class = “someClass”) //it will be used if app is loaded in browser
@iOSFindBy(id =“iOSButtonID”)
private WebElement signIn;

Hi sergy,
How are you? I agree with the way you mentioned. but i personally feel it may difficult to debug if you mix all in one script.

Priyank Shah

I believe it shouldn’t be difficult to debug as you know the platform on which your test is running at a certain time.

I’m fine! Thanks!

I think it looks unusual for most Selenium user. Actually it uses incredibly simple factory mechanisms.
It is expected that problems with readability could be there. The way to solve them is to use laconic/short locators.

Wait for this feature. It can be useful when test are run on different Android/iOS versions.