I am using appium 1.4.13, and server console says, this will affect my existing automation framework since i use it heavily. what is the reason it is getting depreciated
warn: [DEPRECATED] The name locator strategy has been deprecated and will be removed. Please use the accessibility id locator strategy instead.
1 Like
No its in java client implementation, so its advisable to use driver.findElement(MobileBy.accessibilityID(“text/contentDesc”)) … but it will not affect your existing script.
1 Like
agreed with Priyank Shah
By.name(“content-desc-text-of-node-attribute”) and By.AccessibilityID(“content-desc-text-of-node-attribute”) are same and very reliable. I never seen any locator with this strategy being failed.
@amitjaincoer191 @Priyank_Shah
As By.name(“text”) is removed in Appium v1.5.0. I am finding replacement for By.name(“”) method.
When I use MobileBy.accessibilityID(“text/contentDesc”). I think this method find by description not by text. Refer by below logs
Command:-
MobileBy.AccessibilityId(“Yes”);
Appium log:-
[debug] [AndroidBootstrap] Sending command to android: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“com.vervewireless.droid.qa:id/close_banner”,“context”:“”,“multiple”:true}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“id”,“selector”:“com.vervewireless.droid.qa:id/close_banner”,“context”:“”,“multiple”:true}}
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type ACTION
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command action: find
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding ‘com.vervewireless.droid.qa:id/close_banner’ using ‘ID’ with the contextId: ‘’ multiple: true
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[RESOURCE_ID=com.vervewireless.droid.qa:id/close_banner]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[RESOURCE_ID=com.vervewireless.droid.qa:id/close_banner]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element is null: (0)
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=com.vervewireless.droid.qa:id/close_banner]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Failed to locate element. Clearing Accessibility cache and retrying.
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Finding ‘com.vervewireless.droid.qa:id/close_banner’ using ‘ID’ with the contextId: ‘’ multiple: true
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using: UiSelector[RESOURCE_ID=com.vervewireless.droid.qa:id/close_banner]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements selector:UiSelector[RESOURCE_ID=com.vervewireless.droid.qa:id/close_banner]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Element is null: (0)
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] getElements tmp selector:UiSelector[INSTANCE=0, RESOURCE_ID=com.vervewireless.droid.qa:id/close_banner]
[AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result: {“status”:0,“value”: }
Currently I am using xpath instead of name location. Can you tell me what am doing wrong here ?
RamS
July 11, 2016, 5:07pm
5
One workaround for deprecated/removed Text Locator strategy is :
String text1 = "//android.widget.TextView[@text='Test']"
driver.findElement(By.xpath(text1));
1 Like