I am trying to click a link that changes its place on the screen. The other problem is, I don’t actually want to click the link, but a + sign to the left of the link that is fairly far away. I have tried the anchor but it is not working for me. The link looks like this:
I will have to scroll down to click the link I want and as mentioned before, I want to click the green ‘+’ sign at the far left of the link for one specific link. Any ideas? Thank you!
Welcome to uipath community buddy
Fine
– use Element exists Activity if we are able to select the text as a individual element or use image exists Activity and select the image by scrapping them as a image and get the output as a variable of type boolean, named outboolean
–then use a if condition and pass the input as above boolean variable like this outboolean=True
–if this condition gets passed it will go to THEN part of if condition where we can use a ANCHOR BASE Activity with find element activity in left side with the that text been selected as a element or use find image Activity
In the right side use a click image or click Activity and select that element + for clicking
Or select that as image if click image is used…
–or if the above condition fails, it go to ELSE part of if condition
–where we need to use a retry scope Activity and in the upper part use a sequence and mention the first Activity as send hot key Activity with key pgdn
–then use a find element Activity and select the text as element or use find image Activity and select that text as image…
–then in the condition i.e the lower part use a Activity called element exists and select the text as element or use a Image exists, choose the text as a image
–in the property of retry scope Activity increase the number of retries as 50, this retry scope Activity will check for the element or image or if not found, will get scrolled down with send hot key of pgdn
Kindly try this and let know whether works or not buddy
Hope this would help you
Cheers @Double-D
Thank you for the help. Using your advice I was able to use an anchor and click image or click text to make it work, however it only works if the link is in the screen.
Any suggestions on how I can click the image or text if it requires scrolling down and is not in the current window?
Edit: I think the last part of your answer may solve this but am not sure - I am trying it.
I would not recommend using click image. Utilize selectors wherever possible instead.
Do you know the text of the link you want to click? I can’t see the selectors, but I’m guessing this is saved as a table in the webpage or application. Based on that assumption, you can find the row/index of the link displaying the text you’re looking for. Then, extract out the row/index as a variable and use that to click the ‘+’ button on the same row/index
Yes I know the text. I may be doing something wrong with the workflow that Palaniyappan suggested (probably in the action part of the retry scope activity) because it is clicking the wrong image even though i have the retry scope in.
So I want to click the plus by the text 7.01c. Do you mind briefly explaining with the activities how to do what you suggested?
EDIT: also, the location of the link changes each time depending on how many spaces are available (link is to reserve a space)
My answer is completely independent of the previous suggestion. I would not recommend using an anchor and clicking over using click image. If you use anything image-based it is dependent upon it being visible on the screen and is also prone to mis-clicking due to small changes like location of button/text and image resolution changes.
I will attempt to give you at least a starting direction on how to go about it though.
Before you begin, use UiExplorer to click on the ‘+’ button. Look at the attribute tableCol and remember which column it is in.
Use the Find Children activity - the Selector property should be the entire table - not a single row or element within the table! Save this to a variable I’ll call AllRowElements
Use a For Each activity and change the TypeArgument property to be UiElement. Give it the AllRowElements variable you saved in step 1.
a. Use the activity ‘Get Attribute’ and provide the For Each variable (item if you didnt change the name). The attribute is “outertext”. Save this output to a string variable we’ll call UrlText.
b. Put the following in an if activity. If UrlText = YourURLYoureLookingFor
c. In the true statement put another Get Attribute activity in and provide the same For Each variable you did in step a. The attribute should be tableRow. Save the output to a string variable we’ll call RowWithButtonToClick. Add a break activity. Leave the false portion of the if activity blank.
d. Don’t put anything else in the if activity or the for each activity
Use a click activity. To start with, click on the actual button you want. Play around with the selectors so it is using tableRow and tableCol as 2 of the identifying selectors. Make sure it is still a valid selector by using the “validate selector” button. Now edit the selector by removing the hardcoded tableRow = 2 (or whatever tableRow it is) and replace it with your variable RowWithButtonToClick.
And there you go! This should work as long as the url you’re looking for is contained within a table
I know this is basic but I’m having trouble selecting the entire table using the indicate on screen function because when I try to drag it down it will not scroll. Is there a better way?
@Double-D You don’t click + drag. Just try clicking on the outline of the table. You’ll notice if you hover over an individual element it’s a small box. If you hover on the outer box of a single ‘cell’ within the table it’s a slightly larger box. If you hover over the outline on an outer edge of the table it should highlight the entire table. That’s the one you want to click
Thank you I think that worked to select the table! I will try the rest now. To verify, this will work even if the row of the link changes each time correct?
@Double-D that is correct. You are finding the row number based on the visible text. If it is found on row 1 then it will click the button on row 1. If iti s found on row 1393, it will click the button on row 1393
Thank you! I tried both methods. In the first method, I was able to move the page down to the link but it would not click the correct button and in the second method so far nothing is happening but I will keep working on it lol.
This is my program so far: (sorry this is taking so long I have been trying to do it forever)
EDIT:
In the GetAttribute I put “Item” in for element but should it have been selector? When I put it in selector I get an error saying item cannot be converted into string.
I will reply to each individually. For this one, the error is because you put an “inline” if statement within the if activity. It’s a bit redundant in this case You should change it to UrlText = "7.01C". Note that this is case-sensitive and it needs to match exactly. Instead, you could do UrlText.Contains("7.01C") instead if it just contains those words as a portion of the text. Also, if you want it to be case-insensitive, the easiest way to do that with the .contains method is to make sure everything is lower or upper case. So you could do UrlText.ToUpper.Contains("7.01C")
@Double-D - The ‘break’ activity needs to be inside the if UrlText.equals(“7.101C”) activity. The break activity will stop iterating through each element once the correct url has been found. Since it is currently outside the if statement, it is stopping the for each loop after the first try.
For the click activity, you should not edit it within the pop-up box. Instead, click the selector. It will look instead like …=‘1’ tableRow=‘" + RowWithButtonToClick + "’ tag='TD…
Notice how I added double quotes, then +, then your string variable, then another +, then another double quotes. This allows the selector to be used, but it uses your variable titled RowWithButtonToClick in the selector.
Item is correctly put into the element portion (since item is of type UiElement)
Ugh I think I fixed everything - this is now my selector for click:
but nothing is happening. I then put a message box with an output of RowWithButtonToClick and it is coming up blank. I’m wondering if it is even getting a row.