ios - Appium 错误 : start point is not within the bounds of the screen
<p><p>我正在尝试使用 Appium(通过 SauceLabs)在 iOS 上运行 Web 应用程序的自动化测试,但在下面详述的相对简单的测试用例中遇到了问题。</p>
<p>我在 Appium 日志中收到以下错误:</p>
<pre><code>info: 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"}
</code></pre>
<p>查看屏幕截图,有问题的元素确实出现在屏幕上。</p>
<p>我在尝试单击之前尝试滚动到该元素:</p>
<pre><code>((IJavaScriptExecutor)driver).ExecuteScript("arguments.scrollIntoView();", driver.FindElement(By.Id(elementId)));
</code></pre>
<p>并通过 javascript 滚动到它似乎没有任何区别。似乎是某些坐标被弄乱了,但我对 Appium 的工作原理了解得不够多。</p>
<h3>测试</h3>
<p>我创建了一个 jsFiddle <a href="http://jsfiddle.net/fFFPY/5/" rel="noreferrer noopener nofollow">HERE</a> (仅供查看 <a href="http://fiddle.jshell.net/fFFPY/5/show/light/" rel="noreferrer noopener nofollow">here</a> )测试指向。
它有一组列在页面下方的字段。</p>
<p>我正在设置具有以下功能的网络驱动程序:</p>
<pre><code>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");
</code></pre>
<p>WebDriver 测试本身(用 C# 编写)如下所示:</p>
<pre><code>
public void TestSequence()
{
string sequence = "button4,button3,button2";
var fieldIds = sequence.Split(',');
foreach (var fieldId in fieldIds)
{
Console.Write("{0},", fieldId);
if (fieldId == 't')
{
driver.FindElement(By.Id(fieldId)).SendKeys("1");
}
else
{
driver.FindElement(By.Id(fieldId)).Click();
}
}
}
</code></pre>
<p>您可以看到需要单击“序列”字段。只是尝试不同组合的一种方式。 </p>
<p>为了说明问题,以下组合失败:</p>
<pre><code>text1,button1,text4,button3
text4,button3
button4,text3,button2
button4,button3,button2
</code></pre>
<p>这些都很好:</p>
<pre><code>button1,button4,button1,button4,button1
button1,button2,button3,button4
</code></pre>
<p>感谢任何帮助。</p>
<h3>(日志)</h3>
<p>Appium 日志的(希望)相关部分在这里:</p>
<pre><code>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: Executing 'find_element' atom in default context
2014-05-29T17:48:32.076Z - info: Sending javascript command
2014-05-29T17:48:32.076Z - debug: Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:32.084Z - debug: Receiving data from remote debugger
2014-05-29T17:48:32.084Z - debug: 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: Executing 'get_top_left_coordinates' atom in default context
2014-05-29T17:48:32.688Z - info: Sending javascript command
2014-05-29T17:48:32.689Z - debug: Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:32.712Z - debug: Receiving data from remote debugger
2014-05-29T17:48:32.712Z - debug: got applicationSentData response
2014-05-29T17:48:32.712Z - info: Executing 'get_size' atom in default context
2014-05-29T17:48:32.713Z - info: Sending javascript command
2014-05-29T17:48:32.713Z - debug: Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:32.731Z - debug: Receiving data from remote debugger
2014-05-29T17:48:32.731Z - debug: 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: Sending command to instruments: au.getElementsByType('webview')
info: Socket data received (63 bytes)
info: Socket data being routed for 'cmd' event
info: 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: Sending javascript command
2014-05-29T17:48:32.879Z - debug: Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:32.879Z - debug: Sending command to instruments: au.getElement('1').rect()
info: Sending command to instruments: au.getElement('1').rect()
2014-05-29T17:48:32.880Z - debug: Receiving data from remote debugger
2014-05-29T17:48:32.880Z - debug: Receiving data from remote debugger
2014-05-29T17:48:32.881Z - debug: got applicationSentData response
info: Socket data received (108 bytes)
info: Socket data being routed for 'cmd' event
info: 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: Sending command to instruments: au.complexTap({"x":275.069387755102,"y":132.2019230769231,"tapCount":1,"duration":0.3,"touchCount":1})
info: Socket data received (48 bytes)
info: Socket data being routed for 'cmd' event
info: 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: Executing 'find_element' atom in default context
2014-05-29T17:48:34.738Z - info: Sending javascript command
2014-05-29T17:48:34.738Z - debug: Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:34.748Z - debug: Receiving data from remote debugger
2014-05-29T17:48:34.749Z - debug: 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: Executing 'get_top_left_coordinates' atom in default context
2014-05-29T17:48:35.353Z - info: Sending javascript command
2014-05-29T17:48:35.353Z - debug: Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:35.364Z - debug: Receiving data from remote debugger
2014-05-29T17:48:35.364Z - debug: got applicationSentData response
2014-05-29T17:48:35.365Z - info: Executing 'get_size' atom in default context
2014-05-29T17:48:35.365Z - info: Sending javascript command
2014-05-29T17:48:35.365Z - debug: Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:35.377Z - debug: Receiving data from remote debugger
2014-05-29T17:48:35.378Z - debug: 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: Sending command to instruments: au.getElementsByType('webview')
info: Socket data received (63 bytes)
info: Socket data being routed for 'cmd' event
info: 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: Sending javascript command
2014-05-29T17:48:35.545Z - debug: Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:35.545Z - debug: Sending command to instruments: au.getElement('2').rect()
info: Sending command to instruments: au.getElement('2').rect()
2014-05-29T17:48:35.547Z - debug: Receiving data from remote debugger
2014-05-29T17:48:35.547Z - debug: got applicationSentData response
info: Socket data received (110 bytes)
info: Socket data being routed for 'cmd' event
info: 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: Sending command to instruments: au.complexTap({"x":275.069387755102,"y":335.4182692307692,"tapCount":1,"duration":0.3,"touchCount":1})
info: Socket data received (48 bytes)
info: Socket data being routed for 'cmd' event
info: 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: Executing 'find_element' atom in default context
2014-05-29T17:48:37.337Z - info: Sending javascript command
2014-05-29T17:48:37.337Z - debug: Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:37.355Z - debug: Receiving data from remote debugger
2014-05-29T17:48:37.355Z - debug: Receiving data from remote debugger
2014-05-29T17:48:37.355Z - debug: 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: Executing 'get_top_left_coordinates' atom in default context
2014-05-29T17:48:37.952Z - info: Sending javascript command
2014-05-29T17:48:37.953Z - debug: Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:37.965Z - debug: Receiving data from remote debugger
2014-05-29T17:48:37.965Z - debug: got applicationSentData response
2014-05-29T17:48:37.966Z - info: Executing 'get_size' atom in default context
2014-05-29T17:48:37.966Z - info: Sending javascript command
2014-05-29T17:48:37.967Z - debug: Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:37.977Z - debug: Receiving data from remote debugger
2014-05-29T17:48:37.977Z - debug: 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: Sending command to instruments: au.getElementsByType('webview')
info: Socket data received (63 bytes)
info: Socket data being routed for 'cmd' event
info: 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: Sending javascript command
2014-05-29T17:48:38.132Z - debug: Sending _rpc_forwardSocketData: message to remote debugger
2014-05-29T17:48:38.133Z - debug: Sending command to instruments: au.getElement('3').rect()
info: Sending command to instruments: au.getElement('3').rect()
2014-05-29T17:48:38.133Z - debug: Receiving data from remote debugger
2014-05-29T17:48:38.134Z - debug: Receiving data from remote debugger
2014-05-29T17:48:38.134Z - debug: got applicationSentData response
info: Socket data received (110 bytes)
info: Socket data being routed for 'cmd' event
info: 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: Sending command to instruments: au.complexTap({"x":275.069387755102,"y":-31.331730769230774,"tapCount":1,"duration":0.3,"touchCount":1})
info: Socket data received (99 bytes)
info: Socket data being routed for 'cmd' event
info: 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"}
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我无法重现您的错误,请尝试更新到 Appium v1.1 或 1.2。 Sauce Labs 目前默认为 v0.18。</p>
<p>您可以通过添加以下功能来更改 Sauce Labs 上的 appium 版本:</p>
<p><code>appium 版本:'1.1'</code></p>
<p>另外,我使用 <code>value</code> 而不是 <code>keys</code> 来输入输入字段。不知道这在 C# 中是什么意思</p>
<p>我使用了 javascript,但这是一个有效的 <a href="https://gist.github.com/149fe33b4776ca7fb853" rel="noreferrer noopener nofollow">gist</a> </p></p>
<p style="font-size: 20px;">关于ios - Appium 错误 : start point is not within the bounds of the screen,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/23939844/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/23939844/
</a>
</p>
页:
[1]