Hello. I’m trying to automate LinkedIn to connect with people for hiring purposes. In each page there are 10 profiles which the bot needs to connect to and send a custom message. What I’m looking to do is to click on the Connect button and skip those that don’t have the name ‘Connect’. The issue is that I cannot use an idxCounter variable to iterate for each one because after a Connect is made, the button changes and becomes ‘Pending’ until the user accepts the invite. When it’s in Pending, the second Connect, will become the first idx so it will skip it and not click on the next Connect button. So, every time there will be a gap. It’s as if the bot is clicking 1,3,5,7,9 instead of 1,2,3,4,5 etc… That is why I need to use a strict selector for that particular row only. I also tried using anchors but anchors are not useful at all. Moreover, LinkedIn automatically generates a random ID called ember for each button which changes every time the page is refreshed. I have not found anything that differentiates one button from another. Not even the CSS selector. The reason why I need a strict selector and not fuzzy is because sometimes, the inverse happens when clicking on the Connect button. After having the bot write the custom message to that person, it throws me an error right after clicking on the ‘Send’ button. And so the Connect button does not disappear and thus the bot keeps looping in the same place because the button is still visible. Thus, the only way to iterate through each Connect button is to have a strict selector. But I’m unable to differentiate each button separately. I usually include a CSS selector, however, they’re all identical which makes the task harder. Any help is much appreciated. Please only answer if you know what you’re saying.
If the counter is changing by two why not increment your idx counter by 2 and try?
The idx is not incrementing by 2, its by 1. But since after each message is sent the idx number of the next becomes the precedent of the one before it, it will skip the 2nd and go to the third,bz the third has become idx=2. The idx only shows how many matches of the same element are currently present. In this case,its not useful and shouldn’t be used. Thats why another identifyer should be used in the strict selector.
hello @Anil_G The idx is not incrementing by 2, its by 1. But since after each message is sent the idx number of the next becomes the precedent of the one before it, it will skip the 2nd and go to the third,bz the third has become idx=2. The idx only shows how many matches of the same element are currently present. In this case,its not useful and shouldn’t be used. Thats why another identifyer should be used in the strict selector.
So say you click on the first connect and then you check for pending …then again you can check for the same idx of connect because that will give the next button. Thats the logic of how the buttons are changing and how we are trying to tackle. To use a strict selector you need something reliable and in your case the only reliable thing is to use idx =1 always by checking pending count and incrementing it. that way you know every connect you sent is to new person
That still won’t work because checking the pending state will also need an identifier as there could be several pending buttons before which case we are looping through the exact same issue of the connect button.
But forget it as I’ve come up with a clever solution that will solve both issues, whether the connect button disappears or does not disappear. What needs to be done is to use an idx=‘default variable(1)’, and upon clicking on the send button, I’ll add a check app state to check if the error appears. If the error does not appear, it will iterate through connect button 2 without changing the idx number. However, if the error appears, then it will replace the current variable by incrementing to +1, so the idx will become 2 in this case and so on. I still need to look how to implement this though. Thanks for your help anyways. Will mark this as solved.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.