How to enter text into a textfield in a web view using UIAutomation
来源:互联网 发布:网络维护基本知识 编辑:程序博客网 时间:2024/06/05 23:44
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 UIAutomation
is tricky. I am able to tap into the text fields using target.tap({x:100, y:200});
but I want to have UIAutomation
enter text after the field has been tapped. How can I achieve this?
2 Answers
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.
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.
withName()
) do not seem to work with textfields within UIWebView's. Any suggestions? – rdougan Jul 25 '13 at 22:12- How to enter text into a textfield in a web view using UIAutomation
- how to add a member into the PDS using JCL
- How to enter a single quotation mark in Oracle?
- How to Rename a View in ClearCase
- How to Rename a View in ClearCase
- How to display column values in a single cell in Web Intelligence using Oracle database ?
- How to group anagrams in a string into an array
- How to Turn Your Mac Into a Web Server
- HOW TO: Upload a File to a Web Server in ASP.NET by Using Visual Basic .NET
- How To Load CLOB Data from a File into a CLOB column using PL/SQL
- How To Sort Items in a CListCtrl in Report View
- How to Find a Blank Cell in Excel Using Vba
- How to display XML in a JTree using JDOM
- How to post a form using fetch in react native
- How to compile a dlib example using eclipse in windows?
- How to remove ^M in a uploaded text file?
- How to Open a Text File in VB .NET
- How to make a Web crawler using Java?
- activemq在windows下启动报错,闪退问题
- 七天学会NodeJS
- 02-线性结构3. Pop Sequence
- 向指定服务器URL 发送POST方法的请求并用JSON表示
- ajax上
- How to enter text into a textfield in a web view using UIAutomation
- svn常用命令
- 浅谈设计模式之四——Singleton模式
- 使用pull解析和spinner实现省市地区三级联动的效果
- 基于javascript的div浮动效果代码
- C# 数组的复制
- C++沉思录第九章的练习
- 网络透视技术资料及学习笔记
- Lua中的模块与module函数详解