我正在尝试使用Appium(通过SauceLabs)在iOS上运行web应用程序的自动测试,但在下面详细介绍的一个相对简单的测试用例中遇到了一个问题。
我得到以下错误在Appium日志:
info: [INSTSERVER] Got result from instruments: {"status":17,"value":"start point is not within the bounds of the screen"}
2014-05-29T17:21:01.282Z - info: Responding to client with error: {"status":17,"value":{"message":"An error occurred while executing user supplied JavaScript.","origValue":"start point is not within the bounds of the screen"},"sessionId":"47322525-37e0-4f4b-a236-224906d0135c"}
查看屏幕截图,问题中的元素确实出现在屏幕上。
在尝试单击元素之前,我尝试滚动到元素:
((IJavaScriptExecutor)driver).ExecuteScript("arguments[0].scrollIntoView();", driver.FindElement(By.Id(elementId)));
通过javascript滚动到它似乎没有任何区别。似乎有些坐标集被弄乱了,但我对Appium的工作原理了解不够,无法弄清楚。
我在这里创建了一个测试所指向的JSFIDLE(仅在这里查看)。它在页面上有一组字段。
我正在使用以下功能设置web驱动程序:
DesiredCapabilities caps = DesiredCapabilities.IPad();
caps.SetCapability(CapabilityType.Platform, "OS X 10.9");
caps.SetCapability(CapabilityType.Version, "7");
caps.SetCapability("device-orientation", "portrait");
caps.SetCapability("nonSyntheticWebClick", "false");
WebDriver测试本身(用C#编写)看起来像:
[Test]
public void TestSequence()
{
string sequence = "button4,button3,button2";
var fieldIds = sequence.Split(',');
foreach (var fieldId in fieldIds)
{
Console.Write("{0},", fieldId);
if (fieldId[0] == 't')
{
driver.FindElement(By.Id(fieldId)).SendKeys("1");
}
else
{
driver.FindElement(By.Id(fieldId)).Click();
}
}
}
您可以看到,需要单击一系列字段。只是一种尝试不同组合的方法。
为了说明问题,以下组合失败:
text1,button1,text4,button3
text4,button3
button4,text3,button2
button4,button3,button2
然而这些都很好:
button1,button4,button1,button4,button1
button1,button2,button3,button4
任何帮助感激感激。
Appium Log的(希望)相关部分如下:
2014-05-29T17:48:32.074Z - debug: Appium request initiated at /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element
2014-05-29T17:48:32.074Z - debug: Request received with params: {"using":"id","value":"button4"}
2014-05-29T17:48:32.075Z - info: [REMOTE] Executing 'find_element' atom in default context
2014-05-29T17:48:32.076Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:32.076Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:32.084Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:32.084Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:32.085Z - info: Responding to client with success: {"status":0,"value":{"ELEMENT":"5000"},"sessionId":"fc441e9f-8ade-4799-8f87-1653a50a5a49"}
POST /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element 200 11ms - 112b
2014-05-29T17:48:32.687Z - debug: Appium request initiated at /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element/5000/click
2014-05-29T17:48:32.687Z - debug: Request received with params: {}
2014-05-29T17:48:32.688Z - info: [REMOTE] Executing 'get_top_left_coordinates' atom in default context
2014-05-29T17:48:32.688Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:32.689Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:32.712Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:32.712Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:32.712Z - info: [REMOTE] Executing 'get_size' atom in default context
2014-05-29T17:48:32.713Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:32.713Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:32.731Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:32.731Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:32.732Z - info: Pushing command to appium work queue: "au.getElementsByType('webview')"
2014-05-29T17:48:32.732Z - debug: Sending command to instruments: au.getElementsByType('webview')
info: [INSTSERVER] Sending command to instruments: au.getElementsByType('webview')
info: [INSTSERVER] Socket data received (63 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":[{"ELEMENT":"1"}]}
2014-05-29T17:48:32.879Z - info: Pushing command to appium work queue: "au.getElement('1').rect()"
2014-05-29T17:48:32.879Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:32.879Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:32.879Z - debug: Sending command to instruments: au.getElement('1').rect()
info: [INSTSERVER] Sending command to instruments: au.getElement('1').rect()
2014-05-29T17:48:32.880Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:32.880Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:32.881Z - debug: [REMOTE] got applicationSentData response
info: [INSTSERVER] Socket data received (108 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":{"origin":{"x":0,"y":-423},"size":{"width":768,"height":1467}}}
2014-05-29T17:48:32.987Z - info: Converted web coords {"x":351,"y":734}into real coords {"x":275.069387755102,"y":132.2019230769231}
2014-05-29T17:48:32.987Z - info: Pushing command to appium work queue: "au.complexTap({\"x\":275.069387755102,\"y\":132.2019230769231,\"tapCount\":1,\"duration\":0.3,\"touchCount\":1})"
2014-05-29T17:48:32.987Z - debug: Sending command to instruments: au.complexTap({"x":275.069387755102,"y":132.2019230769231,"tapCount":1,"duration":0.3,"touchCount":1})
info: [INSTSERVER] Sending command to instruments: au.complexTap({"x":275.069387755102,"y":132.2019230769231,"tapCount":1,"duration":0.3,"touchCount":1})
info: [INSTSERVER] Socket data received (48 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":""}
2014-05-29T17:48:34.002Z - info: Responding to client with success: {"status":0,"value":"","sessionId":"fc441e9f-8ade-4799-8f87-1653a50a5a49"}
POST /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element/5000/click 200 1317ms - 87b
2014-05-29T17:48:34.737Z - debug: Appium request initiated at /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element
2014-05-29T17:48:34.737Z - debug: Request received with params: {"using":"id","value":"button3"}
2014-05-29T17:48:34.738Z - info: [REMOTE] Executing 'find_element' atom in default context
2014-05-29T17:48:34.738Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:34.738Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:34.748Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:34.749Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:34.749Z - info: Responding to client with success: {"status":0,"value":{"ELEMENT":"5001"},"sessionId":"fc441e9f-8ade-4799-8f87-1653a50a5a49"}
POST /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element 200 14ms - 112b
2014-05-29T17:48:35.352Z - debug: Appium request initiated at /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element/5001/click
2014-05-29T17:48:35.352Z - debug: Request received with params: {}
2014-05-29T17:48:35.352Z - info: [REMOTE] Executing 'get_top_left_coordinates' atom in default context
2014-05-29T17:48:35.353Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:35.353Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:35.364Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:35.364Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:35.365Z - info: [REMOTE] Executing 'get_size' atom in default context
2014-05-29T17:48:35.365Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:35.365Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:35.377Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:35.378Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:35.378Z - info: Pushing command to appium work queue: "au.getElementsByType('webview')"
2014-05-29T17:48:35.378Z - debug: Sending command to instruments: au.getElementsByType('webview')
info: [INSTSERVER] Sending command to instruments: au.getElementsByType('webview')
info: [INSTSERVER] Socket data received (63 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":[{"ELEMENT":"2"}]}
2014-05-29T17:48:35.544Z - info: Pushing command to appium work queue: "au.getElement('2').rect()"
2014-05-29T17:48:35.544Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:35.545Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:35.545Z - debug: Sending command to instruments: au.getElement('2').rect()
info: [INSTSERVER] Sending command to instruments: au.getElement('2').rect()
2014-05-29T17:48:35.547Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:35.547Z - debug: [REMOTE] got applicationSentData response
info: [INSTSERVER] Socket data received (110 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":{"origin":{"x":0,"y":-137.5},"size":{"width":768,"height":1467}}}
2014-05-29T17:48:35.651Z - info: Converted web coords {"x":351,"y":629}into real coords {"x":275.069387755102,"y":335.4182692307692}
2014-05-29T17:48:35.651Z - info: Pushing command to appium work queue: "au.complexTap({\"x\":275.069387755102,\"y\":335.4182692307692,\"tapCount\":1,\"duration\":0.3,\"touchCount\":1})"
2014-05-29T17:48:35.651Z - debug: Sending command to instruments: au.complexTap({"x":275.069387755102,"y":335.4182692307692,"tapCount":1,"duration":0.3,"touchCount":1})
info: [INSTSERVER] Sending command to instruments: au.complexTap({"x":275.069387755102,"y":335.4182692307692,"tapCount":1,"duration":0.3,"touchCount":1})
info: [INSTSERVER] Socket data received (48 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":""}
2014-05-29T17:48:36.634Z - info: Responding to client with success: {"status":0,"value":"","sessionId":"fc441e9f-8ade-4799-8f87-1653a50a5a49"}
POST /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element/5001/click 200 1282ms - 87b
2014-05-29T17:48:37.337Z - debug: Appium request initiated at /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element
2014-05-29T17:48:37.337Z - debug: Request received with params: {"using":"id","value":"button2"}
2014-05-29T17:48:37.337Z - info: [REMOTE] Executing 'find_element' atom in default context
2014-05-29T17:48:37.337Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:37.337Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:37.355Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:37.355Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:37.355Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:37.356Z - info: Responding to client with success: {"status":0,"value":{"ELEMENT":"5002"},"sessionId":"fc441e9f-8ade-4799-8f87-1653a50a5a49"}
POST /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element 200 20ms - 112b
2014-05-29T17:48:37.952Z - debug: Appium request initiated at /wd/hub/session/fc441e9f-8ade-4799-8f87-1653a50a5a49/element/5002/click
2014-05-29T17:48:37.952Z - debug: Request received with params: {}
2014-05-29T17:48:37.952Z - info: [REMOTE] Executing 'get_top_left_coordinates' atom in default context
2014-05-29T17:48:37.952Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:37.953Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:37.965Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:37.965Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:37.966Z - info: [REMOTE] Executing 'get_size' atom in default context
2014-05-29T17:48:37.966Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:37.967Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:37.977Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:37.977Z - debug: [REMOTE] got applicationSentData response
2014-05-29T17:48:37.977Z - info: Pushing command to appium work queue: "au.getElementsByType('webview')"
2014-05-29T17:48:37.977Z - debug: Sending command to instruments: au.getElementsByType('webview')
info: [INSTSERVER] Sending command to instruments: au.getElementsByType('webview')
info: [INSTSERVER] Socket data received (63 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":[{"ELEMENT":"3"}]}
2014-05-29T17:48:38.132Z - info: Pushing command to appium work queue: "au.getElement('3').rect()"
2014-05-29T17:48:38.132Z - info: [REMOTE] Sending javascript command
2014-05-29T17:48:38.132Z - debug: [REMOTE] Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:38.133Z - debug: Sending command to instruments: au.getElement('3').rect()
info: [INSTSERVER] Sending command to instruments: au.getElement('3').rect()
2014-05-29T17:48:38.133Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:38.134Z - debug: [REMOTE] Receiving data from remote debugger
2014-05-29T17:48:38.134Z - debug: [REMOTE] got applicationSentData response
info: [INSTSERVER] Socket data received (110 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":0,"value":{"origin":{"x":0,"y":-137.5},"size":{"width":768,"height":1467}}}
2014-05-29T17:48:38.243Z - info: Converted web coords {"x":351,"y":161}into real coords {"x":275.069387755102,"y":-31.331730769230774}
2014-05-29T17:48:38.243Z - info: Pushing command to appium work queue: "au.complexTap({\"x\":275.069387755102,\"y\":-31.331730769230774,\"tapCount\":1,\"duration\":0.3,\"touchCount\":1})"
2014-05-29T17:48:38.243Z - debug: Sending command to instruments: au.complexTap({"x":275.069387755102,"y":-31.331730769230774,"tapCount":1,"duration":0.3,"touchCount":1})
info: [INSTSERVER] Sending command to instruments: au.complexTap({"x":275.069387755102,"y":-31.331730769230774,"tapCount":1,"duration":0.3,"touchCount":1})
info: [INSTSERVER] Socket data received (99 bytes)
info: [INSTSERVER] Socket data being routed for 'cmd' event
info: [INSTSERVER] Got result from instruments: {"status":17,"value":"start point is not within the bounds of the screen"}
2014-05-29T17:48:38.902Z - info: Responding to client with error: {"status":17,"value":{"message":"An error occurred while executing user supplied JavaScript.","origValue":"start point is not within the bounds of the screen"},"sessionId":"fc441e9f-8ade-4799-8f87-1653a50a5a49"}
我无法重新创建您的错误,请尝试更新到Appium v1.1或1.2。沙司实验室现在默认为v0.18。
您可以通过添加以下功能来更改Sauce Labs上的appium版本:
应用程序版本:“1.1”
另外,我使用value
而不是键
在输入字段中键入内容。不确定这在C中翻译成什么#
我用的是JavaScript但这里有个工作要点
Appium 1.5.2不能执行SWIPE,总是给出错误“点不在屏幕的边界内”,但是同样的命令在Appium 1.4.13中运行得非常好 环境: APPIUM 1.5.2iOS9.2.1 MAC OS 知道怎么解决这个问题吗? 谢谢
问题内容: 您知道如何在Blackberry应用程序中创建无边界弹出屏幕吗? 问题答案:
结果应该只是导致屏幕边缘的反弹效果,但相反,对象左右抽搐,但不会像向右移动一样向左移动...... 这是移动矩形的方法;(此处的输入是在 if 语句中更改的相同“xVelocity”,它之所以这样做,是因为有多个对象) 此方法仅应用于更新方法中的不同矩形,它们向右移动即可,但我不确定转身有什么问题。
下面给出依赖关系树。堆栈超过流要求放更多的文本。
我在使用边界向我的电子邮件中添加VCalendar时遇到了问题。我在gmail中没有得到一个错误,它只是没有显示消息包含一个事件。这是电子邮件来源: Content-class: urn: Content-class: calendarmessage Content-transver-Encode: 8bit MIME-版本: 1.0 Content-Type: Multipart/混合; 边界=
问题内容: 我怎样才能让一个窗口(如,,,,等)预留屏幕的边缘,就像一个码头,任务栏,Trillian的,或者微软的OneNote可以吗?我的目标是尽可能使用标准的JDK库。 问题答案: 此行为非常特定于Windows操作系统,因此无法在标准JDK或AWT / Swing中执行此操作,因为它们需要在多个不同的操作系统上一致地工作。 与您想要的最接近的等效方法是获取当前屏幕的边界并移动/调整窗口大小