简体   繁体   English

UIPath:如何在网站上找到文本超链接并单击它

[英]UIPath: How to find texted hyperlink on website and click on it

I am faced with user acceptance testing a website used in a previous project.我面临着用户验收测试之前项目中使用的网站。 I want to find the texted hyperlink and click on it based on a value extracted from excel. The text, as well as the position of the hyperlink changes on each iteration.我想找到文本超链接并根据从 excel 中提取的值单击它。文本以及超链接的 position 在每次迭代时都会发生变化。

I found the solution!我找到了解决方案!

Make use of a click text activity.使用点击文本活动。 When indicating the element on the screen make sure you select the whole element where the search is required.在屏幕上指示元素时,请确保您 select 是需要搜索的整个元素。 In my case it returned this 'col-md-10' value at the webctrl class but I don't know if it will be applicable to everyone.在我的例子中,它在 webctrl class 返回了这个“col-md-10”值,但我不知道它是否适用于所有人。 The second and most important thing to look at that kept me busy for a while is the OffsetX and OffsetY properties in the properties pane.让我忙了一会儿的第二个也是最重要的事情是属性窗格中的 OffsetX 和 OffsetY 属性。 You will see that when running the process the cursor will move to the correct place to click BUT it will fall short (either not up enough or to left etc).您会看到,在运行该过程时,cursor 将移动到正确的位置以单击但它会不足(不够高或向左等)。 This is because the center pixels of the activity and HTML differ.这是因为activity的中心像素和HTML不同。 Play around with the offset.玩弄偏移量。 In my case all it needed was a '-20' at the OffsetY property.在我的例子中,它所需要的只是 OffsetY 属性中的“-20”。 这是我自动化的网站,想点击超链接区域名称 webctrl 类值

It is good that you found a solution.很高兴您找到了解决方案。 Another solution might be to use a selector seeking a full xpath to locate the element and click it.另一种解决方案可能是使用选择器寻找完整的 xpath 来定位元素并单击它。

You can always hit F12 in your browser, and locate the element in question (or just right click the element and click examine).您始终可以在浏览器中按 F12,找到有问题的元素(或者只需右键单击该元素并单击检查)。 From there you can Right click the element in the developer tab and copy full xpath!从那里您可以右键单击开发人员选项卡中的元素并复制完整的 xpath!

That may be a more versatile solution which shouldn't run into trouble "aiming" the click.这可能是一种更通用的解决方案,不应在“瞄准”点击时遇到麻烦。

I think part of the poster's point may have been missed.我认为张贴者的部分观点可能被遗漏了。 My personal example is a 2-line URL-type clickable item: wrapped because the encompassing area is too small width wise.我个人的例子是一个 2 行 URL 类型的可点击项目:包裹是因为包围区域的宽度太小。 The normal click activity falls (vertically) exactly between those 2 lines.正常的点击活动(垂直)正好落在这两条线之间。 And THAT area is not clickable.该区域不可点击。 ie It shows an Arrow instead of a Finger/Hand.即它显示箭头而不是手指/手。 So it kind of needs to go to the selected item, and then UP a handful of pixels - allowing it to change from an arrow to a Finger/Hand (and allow clicking).所以它需要 go 到所选项目,然后向上几个像素 - 允许它从箭头变为手指/手(并允许点击)。 I'm going to try Click-Text and see if that works.我打算试试 Click-Text,看看是否可行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM