微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

硒与 Power Apps

如何解决硒与 Power Apps

我们有一个客户要求在 Power 应用中实现测试自动化。 Power Apps 有自己的测试框架,但仍处于实验模式,不建议用于生产环境。

我有使用 Selenium 的经验,但在为 Power Apps 定位 Web 元素时遇到问题。 我正在尝试找到一个文本框并输入任何值,即使网络元素是独一无二的,但 selenium 无法找到这些元素。

HTML

<div class="canvasContentDiv appmagic-control-view appmagic-content- 
control-name _vst_" data-control-id="17" data-control-name="TextInput1" 
style="width: 419px; height: 60px; z-index: 17; position: absolute; top: 
517px; left: 105px;"><div class="appmagic-borderfill-container" 
style="background-color: rgb(186,202,226); border-style: solid; border- 
width: 2px; border-color: rgb(0,18,107); border-radius: 5px; margin: 
-1px;"><div class="appmagic-border-inner" style="margin: -1px;"><div 
class="react-knockout-control" spellcheck="false" style="position: 
absolute; inset: 0px;"> 
 <div class="appmagic-textBox" touch-action="pan-x pan-y" appmagic- 
control="TextInput1">
<!-- ko if: (mode() === "multiline") --><!-- /ko -->
<!-- ko if: (mode() !== "multiline") -->
<input appmagic-control="TextInput1textBox" class="appmagic-text mousetrap 
block-undo-redo" maxlength="10000" data-bind="
  attr: {
    type: mode() === 'password' ? 'password' : 'text',title: properties.Tooltip() || null,'aria-label': properties.AccessibleLabel() || null,placeholder: properties.HintText,readonly: viewState.displayMode() === 
    AppMagic.Constants.displayMode.View,contenteditable: viewState.displayMode() === 
    AppMagic.Constants.displayMode.Edit,'data-control-part': properties.Clear() ? 'text clearable' : 'text',inputmode: keyboardMode
  },css: {
    underline: properties.Underline,strikethrough: properties.Strikethrough,readonly: viewState.displayMode() === 
   AppMagic.Constants.displayMode.View
  },value: text,event: {
    click: handleClick,change: handleOnChange
  },style: {
    fontFamily: properties.Font,fontSize: properties.Size,color: autoproperties.Color,fontWeight: properties.FontWeight,fontStyle: properties.Italic,textAlign: properties.Align,lineHeight: properties.LineHeight,paddingTop: properties.PaddingTop,paddingRight: properties.PaddingRight,paddingBottom: properties.PaddingBottom,paddingLeft: properties.PaddingLeft
  },disable: viewState.displayMode() === 
 AppMagic.Constants.displayMode.disabled" type="text" placeholder="Team 
 name..." contenteditable="true" data-control-part="text" inputmode="text" 
 tabindex="15" style="font-family: &quot;Open Sans&quot;,sans-serif; font- 
 size: 21pt; color: rgb(0,0); font-weight: normal; font-style: normal; 
 text-align: left; line-height: 1.2; padding: 5px 5px 5px 12px;"> 

 <div class="appmagic-text-clear-container">
 <button class="appmagic-text-clear-button" data-control-part="clear" data- 
  bind="
    visible: isFocused() &amp;&amp; properties.Clear() &amp;&amp; 
 properties.Text() &amp;&amp; mode() !== 'password' &amp;&amp; 
 viewState.displayMode() === AppMagic.Constants.displayMode.Edit,event: {click: handleClearClick},attr: {'aria-label': AppMagic.Strings.TextInputClearButtonLabel}" aria- 
 label="Clear value" tabindex="16" style="display: none;">
    <svg class="appmagic-text-clear-svg" xmlns="http://www.w3.org/2000/svg" 
viewBox="0 0 12 12" aria-hidden="true" focusable="false">
      <polygon points="12,1.1 10.9,0 6,4.9 1.1,0 0,1.1 4.9,6 0,10.9 1.1,12 
6,7.1 10.9,12 12,10.9 7.1,6" data-bind="style: {fill: 
autoproperties.Color}" style="fill: rgb(0,0);"></polygon>
    </svg>
</button>
 </div>
<!-- /ko -->
</div>
</div></div></div></div> 

尝试在下面找到网络元素-

driver.findElement(By.xpath("//div[@class='appmagic-textBox']")).sendKeys("test");

driver.findElement(By.xpath("//input[@class='appmagic-text mousetrap block-undo-redo']")).sendKeys("Test");

以下是Selenium返回的错误-

enter image description here

任何有关这方面的帮助或建议都会非常有帮助。

提前致谢。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?