How to enter text into a textfield in a web view using UIAutomation
2015-04-22 23:06
633 查看
up vote1down votefavorite | My iOS app has a log-in page with username and password textfields. These text fields are in a web view. I am trying to automate the log-in process with UIAutomation. I know that working with content in a web view with UIAutomationis tricky. I am able to tap into the text fields using target.tap({x:100, y:200});but I want to have UIAutomationenter text after the field has been tapped. How can I achieve this? ios iphone uiwebview ui-automation ios-ui-automation
| |||
add a comment |
2 Answers
activeoldestvotesup vote2down vote | You can do something like: Get the reference to the webview var webView=window.scrollViews()[0].webViews()[0]; Tap the textView that you want to edit: webView.textFields()[0].tap(); Use the keyboard UIATarget.localTarget().frontMostApp().keyboard().typeString("text"); You can use: webView.logElementTree()to find out your webview.
| ||||||||
a comment |
up vote0down vote | Yes this is quite possible but instead of going through the position of the text field, I'd suggest going through the id/name of the text field. Another approach is to traverse the application window. Try following this apple's documentation - http://developer.apple.com/library/ios/#documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/UsingtheAutomationInstrument/UsingtheAutomationInstrument.html This will give you a head start and many other ideas.
| ||||
|
相关文章推荐
- [Tips] How to Add New field into Shapefile attribute table in ArcGIS ?
- How to monitor Web server performance by using counter logs in System Monitor in IIS
- How to make item view render rich (html) text in Qt
- How to Modify the web.config file in SharePoint using SPWebConfigModification?
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- Creating a NuGet Package in 7 easy steps - Plus using NuGet to integrate ASP.NET MVC 3 into existing Web Forms applications
- How to create new view by using cleartool command in Clearcase?
- How to find indexPath for tapped button in tableView Using Seque
- using iscroll.js and iscroll jquery plugin in android webview to scroll div and ajax load data.
- how to implement gesture detector onfling in webview in android - Stack Overflow
- How to display column values in a single cell in Web Intelligence using Oracle database ?
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- Units Problem: How to read text size as custom attr from xml and set it to TextView in java code
- How to invoke Java web service in ASP.net using C#
- Android, How to get redirection event in WebView?
- How to get the password text in a text with password property from another process using C++ - 用C++如何从不同进程获取密码框文本
- how to call javascript function in webview
- How to set the default input focus on a field in an HTML web form
- HOW TO: Upload a File to a Web Server in ASP.NET by Using Visual Basic .NET
- [Android 問題] How to Activate Multi-Touch in WebView (for Web Browser, Google Map, etc)?