-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to obtain password attribute #6281
Comments
There is currently no way to pull this information. I'm not sure where the .app is getting this from. If it is a WebElement you might be able to change contexts and get the information. |
I looked at the implementation for Appium.app. It looks like the attribute is obtained from the last page source's xml response. I hit the Refresh button in the Appium inspector and saw that the server response did provide the password attribute: android.widget.EditText index="1" text="" class="android.widget.EditText" package="" content-desc="" checkable="false" checked="false" clickable="false" enabled="true" focusable="true" focused="false" scrollable="false" long-clickable="false" password="true" selected="false" bounds="[52,788][1388,944]" resource-id="" instance="1"/ If I understand your response correctly, there is currently not a way to obtain this attribute from the server even though it is provided in the xml response after getting the page source? I am able to get other attributes for the element (ex. getAttribute("resourceId") works). |
Ah. Ok, it is just parsing the XML, then. The The attributes that can be retrieved directly can be found here: |
Does this issue solved? |
I have the same problem and would be glad to get any solution. |
Please, fix this bug/issue-bug.. |
@sravanmedarapu @mykola-mokhnach @imurchie public boolean getBoolAttribute(final String attr) throws UiObjectNotFoundException, NoAttributeFoundException, UiAutomator2Exception {
boolean res;
if ("enabled".equals(attr)) {
res = element.isEnabled();
} else if ("checkable".equals(attr)) {
res = element.isCheckable();
} else if ("checked".equals(attr)) {
res = element.isChecked();
} else if ("clickable".equals(attr)) {
res = element.isClickable();
} else if ("focusable".equals(attr)) {
res = element.isFocusable();
} else if ("focused".equals(attr)) {
res = element.isFocused();
} else if ("longClickable".equals(attr)) {
res = element.isLongClickable();
} else if ("scrollable".equals(attr)) {
res = element.isScrollable();
} else if ("selected".equals(attr)) {
res = element.isSelected();
} else if ("displayed".equals(attr)) {
res = invoke(method(UiObject2.class, "getAccessibilityNodeInfo"), element) != null ? true : false;
} else if ("password".equals(attr)) {
res = AccessibilityNodeInfoGetter.fromUiObject(element).isPassword();
} else {
throw new NoAttributeFoundException(attr);
}
return res;
} |
You are welcome to create a PR containing your fix ;) Here you can find server source: https://github.com/appium/appium-uiautomator2-server |
@Carlgege yes, please do submit a PR! |
fix the issue(appium/appium#6281)
Closed as fixed |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The problem
When I attempt to obtain the password attribute, Appium responds with an error that the element can not be located.
When viewing the element using the Appium inspector, it is clear that the element does have the password attribute:
## Environment
Appium version: v1.4.13, v1.4.16
Desktop OS: Yosemite v10.10.5
Node.js Version: v4.2.3
Mobile Platform: Android
Emulator: Genymotion, Samsung Galaxy S6 - 6.0.0 - API 23
Noticed error on both Appium CLI and Appium.app
Link to Appium logs
Can not post full log on gist. Here is the log output from where the error occurred:
Code To Reproduce Issue [ Good To Have ]
used java-client's .getAttribute("password") on a WebElement.
The text was updated successfully, but these errors were encountered: