I have a webview in which user has to type their email and password in the corresponding input fields. I want to show the email friendly keyboard when the user taps on the email field. How to do it using javascript ?
I tried using the javascript by using the following code
String emailKeyboard="document.getElementById('src').type=\"email\";";
mWebView.loadUrl("javascript:(function() { " + emailKeyboard +"})()");
also i tried by getting the element by name as
String emailKeyboard="document.getElementByName('j_username').type=\"email\";";
mWebView.loadUrl("javascript:(function() { " + emailKeyboard +"})()");
where j_username is the name of the input field. But it is not working. Any help greatly appreciated.
Thanks,
Senthil.M
Why not just set the type of the fields directly in the HTML rather than trying to add them on the fly (which causes more strain on performance anyway...).
Related
Is there any way, through which my android application can interact with a web page that I provide?
For example: I want to retrieve user information from a web based erp-system. So first user needs to log-in with his/her credentials. After that, the student home page opens up. I want to know, suppose that I have the credentials in simple text.
How can I insert, 'click' certain buttons elements of the web-page, in background, without any user intervention. Also, once the homepage loads up, Is there any way through which I can access data from DOM elements?
Simply, I just want to know, is this even possible? All the user interaction taking place in the background? And if yes, can someone just point me in a right direction? I actually don't know how to 'term' this process.
Thank You.
EDIT:
I found out, that the button has an associative function 'logincheck()'. So, by calling this function, same can be achieved, right? Problem is, how the credentials can be inserted in the labels and how this function can be called?
You can manually download the html page on interests and parse it using regex to find out info contained in DOM elements.
Or it s possible to automatize also the login by using for example Python and the request lib to issue HTTP requests and retrieve the pages.
Another option, more graphic oriented is to use JWebUnit lib (for Java) to navigate the pages and login etc
If you are the owner of the webpage or if you have access to it's code, look for division IDs for the form fields that you're trying to fill. Then, in your WebView, once the login page loads, you can fill the form using JavaScript -
Assuming that the username form field has an id 'username' and the password field has an id 'password',
webView.getSettings().setJavaScriptEnabled(true);
String js = "javascript:" +
"document.getElementById('username').value=" + "'" + username + "';" +
"document.getElementById('password').value=" + "'" + password + "';" +
"document.forms[0].submit();";
webView.loadUrl(js);
Hi. Using Accessibility, i am trying to auto fill username &
password of an any app from my app which is managing username &
password of all apps like dashlane. i found one way to auto fill
field value using Action_Paste. when user starts to focusing on
EditText it will get the AccessibilityNodeInfo by using getSource() method, using that it auto
fills EditText Filed, below is a code for above process.
Code:
AccessibilityNodeInfo source = event.getSource();
if (source != null) {
ClipboardManager clipboard = (ClipboardManager) MyAccessibilityService.this.getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("label", "TEST DATA");
clipboard.setPrimaryClip(clip);
source.performAction(AccessibilityNodeInfo.ACTION_PASTE);
Toast.makeText(MyAccessibilityService.this, "Pasted Successfully", Toast.LENGTH_LONG).show(0;
}
Here i need to extend my ui like, it needs identify the login page, once its confirmed as a login page it will show the list of login item. based on user selection it will auto fill username field & password field.
Here i have two question
how to identify the login page of an app, i tried something like, when user clicks a First Edittext filed i will search for next node and check whether it is password filed or not? i used getchild() method. but does not give the child element. When login page loaded in app, i need identify whether it is login field or not? How can i identify a login page, please any tutorial welcome.
based on the source i am filling the field values. if i identified a login page then how to get AccessibilityNodeInfo of username & password. So that i can fill both fields rite?
i spent time for those problem.but i cant get any thing. please anyone can give deep explanation & tutorials for the above problems. thanks.
Use getRootInActiveWindow() to get the root node & iterate the tree to check all the nodes.
My answer here might help.
This way, you will find your Username & Password nodes.
Now, you can paste the text in these nodes.
But i will suggest to not use clipboard to fill passwords as there are some apps that continuously watch your clipboard.
Such apps can intercept your login credentials.
I have created an app using jelly bean version 4.2, the issue is that I have to created an input field on submission of that values a message should be sent. I want to know how this input values can be automatically put in the text field of the message.
Can anyone please help me out in sorting this issues.
I am presuming(as no additional info is available) that you want to display some message, like a toast, which should contain the value of your text field.
You can use like:
EditText text = (EditText)findViewById(R.id.textFieldID);
String value = text.getText().toString();
Then use this string as message in your toast or pass it as an argument!!
Hope this helps!!
I'm trying to build an app in which a user inputs ingredients into multiple text fields displayed within my app. when the user presses enter all of their text is formatted as a Google search, my app would then open the default web-browser on the users phone and display a google search for recipes containing the ingredients that they entered.
So far I've tried the google custom search engine and I've been searching the internet for hours now on how I could go about actually building this. So any input or expertise you may have that could help me would really be appreciated.
you can open an intent with specified URL like this
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(strURL));
startActivity(myIntent);
strURL can be constructed with appending
google.com/search?q=searchstring1+searchstring2
to your search string
EDIT:
text1=editText1.getText(); and so on you can get text from different text inputs
strURL=text1 + "+" + "text2" + "+" + text3;
Just open a browser to https://www.google.com/search?q=term1+term2+term3 where term1, term2, and term3 are the terms you want to search for (and of course you can add more).
in my application I'm calling web service for creating lakes.for that user enters the lake name in edit text and i'm sending that entered name to web service.
now when I'm entering string with space the web service could not call successfully.it shows an exception that illegal char at (the space which I've give in edit text).
i"m not able to find solution for this since i want to send name with space in it.
any help is appreciated.
Thanks
before adding lakeName to the webservice url, do this
final String encodedLakeName = URLEncoder.encode(lakeName, "UTF-8");
Now use this encodedLakeName.