appium-for-mac icon indicating copy to clipboard operation
appium-for-mac copied to clipboard

cant interact with elements when using @FindBy page object model annotation

Open chronicideas opened this issue 5 years ago • 4 comments

driver.findElement(By.xpath(str)).click //works but... @FindBy(xpath = str) public WebElement btn;

public void method() { btn.click(); // this does not work }

chronicideas avatar Jan 24 '19 18:01 chronicideas

Would be good if we had an @MacFindBy annotation like the one for windows @WindowsFindBy

I'm trying to test an App at work that is on both Mac and Windows.

Originally I used Squish (commercial tool) to test on Mac (as it was developed in C# and not native Cocoa app) and then C# CodedUI for Windows version.

CodedUI is being deprecated and Microsoft etc recommend using Appium with WinAppDriver. It would be absolutely amazing if I could use Page Objects Model for Mac tool as well and just use one framework for both platforms :D

chronicideas avatar Jan 26 '19 13:01 chronicideas

@chronicideas :- do you get any solution for this?

sankalphirke avatar Nov 28 '19 09:11 sankalphirke

Have not heard anything around this. But Simon Stewart, the lead on Selenium recommends AGAINST using PageFactory. More recently I have learnt that @FindBy elements don't follow YAGNI principles (you ain't gona need it). Really we should make our own page objects and elements and only init them when we need to use them. So that itself might be a solution for this. I'm sure others would still appreciate support with PageFactory though.

testifyqa avatar Nov 28 '19 09:11 testifyqa

Anything new to this? Looking for answer too :-)

puresk avatar Feb 16 '21 17:02 puresk