【问题标题】:uipath error Click on onbeforeunload popup not working in chromeuipath错误单击onbeforeunload弹出窗口在chrome中不起作用
【发布时间】:2018-10-24 03:36:41
【问题描述】:

我在 chrome 中遇到 onbeforeunload 窗口事件弹出问题。我已经安装了 chrome 扩展。

步骤:

  1. 使用 url 创建打开浏览器活动:

    https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onbeforeunload"\
    
  2. 使用选择器创建点击事件:

    <webctrl aaname='Click here to go to w3schools.com' tag='A' />
    
  3. 使用选择器创建点击事件:

    <ctrl name='Leave site?' role='dialog' /><ctrl name='Leave' role='push button' />
    

我的问题是第二次点击不起作用。

Main.xaml:

<Activity mc:Ignorable="sap sap2010 sads" x:Class="Main" mva:VisualBasic.Settings="{x:Null}" sap2010:WorkflowViewState.IdRef="Main_1"
 xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities"
 xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
 xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
 xmlns:sap2010="http://schemas.microsoft.com/netfx/2010/xaml/activities/presentation"
 xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
 xmlns:sco="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib"
 xmlns:ui="http://schemas.uipath.com/workflow/activities"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <TextExpression.NamespacesForImplementation>
    <sco:Collection x:TypeArguments="x:String">
      <x:String>System.Activities</x:String>
      <x:String>System.Activities.Statements</x:String>
      <x:String>System.Activities.Expressions</x:String>
      <x:String>System.Activities.Validation</x:String>
      <x:String>System.Activities.XamlIntegration</x:String>
      <x:String>Microsoft.VisualBasic</x:String>
      <x:String>Microsoft.VisualBasic.Activities</x:String>
      <x:String>System</x:String>
      <x:String>System.Collections</x:String>
      <x:String>System.Collections.Generic</x:String>
      <x:String>System.Data</x:String>
      <x:String>System.Diagnostics</x:String>
      <x:String>System.Drawing</x:String>
      <x:String>System.IO</x:String>
      <x:String>System.Linq</x:String>
      <x:String>System.Net.Mail</x:String>
      <x:String>System.Xml</x:String>
      <x:String>System.Xml.Linq</x:String>
      <x:String>UiPath.Core</x:String>
      <x:String>UiPath.Core.Activities</x:String>
      <x:String>System.Windows.Markup</x:String>
    </sco:Collection>
  </TextExpression.NamespacesForImplementation>
  <TextExpression.ReferencesForImplementation>
    <sco:Collection x:TypeArguments="AssemblyReference">
      <AssemblyReference>System.Activities</AssemblyReference>
      <AssemblyReference>Microsoft.VisualBasic</AssemblyReference>
      <AssemblyReference>mscorlib</AssemblyReference>
      <AssemblyReference>System.Data</AssemblyReference>
      <AssemblyReference>System</AssemblyReference>
      <AssemblyReference>System.Drawing</AssemblyReference>
      <AssemblyReference>System.Core</AssemblyReference>
      <AssemblyReference>System.Xml</AssemblyReference>
      <AssemblyReference>System.Xml.Linq</AssemblyReference>
      <AssemblyReference>UiPath.Core</AssemblyReference>
      <AssemblyReference>UiPath.Core.Activities</AssemblyReference>
      <AssemblyReference>PresentationFramework</AssemblyReference>
      <AssemblyReference>WindowsBase</AssemblyReference>
      <AssemblyReference>PresentationCore</AssemblyReference>
      <AssemblyReference>System.Xaml</AssemblyReference>
      <AssemblyReference>System.ComponentModel.Composition</AssemblyReference>
      <AssemblyReference>System.ServiceModel</AssemblyReference>
    </sco:Collection>
  </TextExpression.ReferencesForImplementation>
  <ui:OpenBrowser UiBrowser="{x:Null}" BrowserType="Chrome" DisplayName="Open browser" Hidden="False" sap2010:WorkflowViewState.IdRef="OpenBrowser_3" NewSession="True" Private="False" Url="https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_onbeforeunload">
    <ui:OpenBrowser.Body>
      <ActivityAction x:TypeArguments="x:Object">
        <ActivityAction.Argument>
          <DelegateInArgument x:TypeArguments="x:Object" Name="ContextTarget" />
        </ActivityAction.Argument>
        <Sequence DisplayName="Do" sap2010:WorkflowViewState.IdRef="Sequence_25">
          <ui:Click DelayBefore="{x:Null}" DelayMS="{x:Null}" ClickType="CLICK_SINGLE" DisplayName="Click 'A  https://www.w3school...'" sap2010:WorkflowViewState.IdRef="Click_6" KeyModifiers="None" MouseButton="BTN_LEFT" SendWindowMessages="False" SimulateClick="False">
            <ui:Click.CursorPosition>
              <ui:CursorPosition Position="Center">
                <ui:CursorPosition.OffsetX>
                  <InArgument x:TypeArguments="x:Int32" />
                </ui:CursorPosition.OffsetX>
                <ui:CursorPosition.OffsetY>
                  <InArgument x:TypeArguments="x:Int32" />
                </ui:CursorPosition.OffsetY>
              </ui:CursorPosition>
            </ui:Click.CursorPosition>
            <ui:Click.Target>
              <ui:Target ClippingRegion="{x:Null}" Element="{x:Null}" TimeoutMS="{x:Null}" InformativeScreenshot="ad281f65b6ab6cc6ce588fb1cf53160a" Selector="&lt;webctrl aaname='Click here to go to w3schools.com' tag='A' /&gt;" WaitForReady="INTERACTIVE" />
            </ui:Click.Target>
          </ui:Click>
          <ui:Click DelayBefore="{x:Null}" DelayMS="{x:Null}" ClickType="CLICK_SINGLE" DisplayName="Click 'push button  Leave'" sap2010:WorkflowViewState.IdRef="Click_5" KeyModifiers="None" MouseButton="BTN_LEFT" SendWindowMessages="False" SimulateClick="False">
            <ui:Click.CursorPosition>
              <ui:CursorPosition Position="Center">
                <ui:CursorPosition.OffsetX>
                  <InArgument x:TypeArguments="x:Int32" />
                </ui:CursorPosition.OffsetX>
                <ui:CursorPosition.OffsetY>
                  <InArgument x:TypeArguments="x:Int32" />
                </ui:CursorPosition.OffsetY>
              </ui:CursorPosition>
            </ui:Click.CursorPosition>
            <ui:Click.Target>
              <ui:Target ClippingRegion="{x:Null}" Element="{x:Null}" TimeoutMS="{x:Null}" InformativeScreenshot="a52efda054f51d9ac88fd53b22f4663a" Selector="&lt;ctrl name='Leave site?' role='dialog' /&gt;&lt;ctrl name='Leave' role='push button' /&gt;" WaitForReady="INTERACTIVE" />
            </ui:Click.Target>
          </ui:Click>
        </Sequence>
      </ActivityAction>
    </ui:OpenBrowser.Body>
    <sads:DebugSymbol.Symbol>dyhFOlxVaVBhdGhXb3Jrc3BhY2VcV2hhdHNhcHBNc2dcTWFpbi54YW1sBzoDYxQCAQE6vQE6iQICAQdACV8UAgECQQtPFgIBBVALXhYCAQNNngFN5AECAQZcngFc/QECAQQ=</sads:DebugSymbol.Symbol>
  </ui:OpenBrowser>
  <sap2010:WorkflowViewState.ViewStateManager>
    <sap2010:ViewStateManager>
      <sap2010:ViewStateData Id="Click_6" sap:VirtualizedContainerService.HintSize="314,106" />
      <sap2010:ViewStateData Id="Click_5" sap:VirtualizedContainerService.HintSize="314,106" />
      <sap2010:ViewStateData Id="Sequence_25" sap:VirtualizedContainerService.HintSize="336,376">
        <sap:WorkflowViewStateService.ViewState>
          <scg:Dictionary x:TypeArguments="x:String, x:Object">
            <x:Boolean x:Key="IsExpanded">True</x:Boolean>
          </scg:Dictionary>
        </sap:WorkflowViewStateService.ViewState>
      </sap2010:ViewStateData>
      <sap2010:ViewStateData Id="OpenBrowser_3" sap:VirtualizedContainerService.HintSize="414,475" />
      <sap2010:ViewStateData Id="Main_1" sap:VirtualizedContainerService.HintSize="454,635" />
    </sap2010:ViewStateManager>
  </sap2010:WorkflowViewState.ViewStateManager>
</Activity>

【问题讨论】:

    标签: uipath


    【解决方案1】:

    这不适用于脚本警报。
    请找到已解决的工作流程here。这是解决问题的一种棘手方法。

    【讨论】:

    • 感谢 Manoj 为您解答。但是第三个选择器对我不起作用。我收到错误,因为 找不到与此选择器对应的 UI 元素: &lt;wnd app='chrome.exe' cls='Chrome_WidgetWin_1' title='Leave site?' /&gt;&lt;wnd cls='Intermediate D3D Window' /&gt;
    • 嗨@JamesJaved,我不确定原因,但可能属于机器人和铬。 请使用以下选择器:
    猜你喜欢
    • 2018-12-17
    • 1970-01-01
    • 1970-01-01
    • 2012-10-09
    • 1970-01-01
    • 1970-01-01
    • 2016-11-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多