Help with macro clicks

davep2

New Member
VIP
Joined
Feb 26, 2019
Messages
35
Reaction score
1
Achievement
Hello, i have been trying to program clicks using macro, but some websites when viewed through the 9hits viewer have a (i don't know the correct name) "pop-up" that appears on top of everything else and doesn't let the clicks i programed go on.
These are pop-ups to accept cookies, or to subscribe a newsletter, but unless they are clicked first, either to accept or close the pop-up, no other click on the page will work.

Website examples are https://www.trendout.pt/ this one shows a newsletter subscription pop-up; and https://www.forbes.com/sites/billeehoward/2019/02/25/emotional-intelligence/ this one shows a cookies pop-up to be accepted so the page can be viewed and interacted.

Is there any way to use macro to click on those pop-ups and accept/close them?
 

MauroS5

Administrator
Staff member
Rule The Galaxy
Joined
May 10, 2018
Messages
199
Reaction score
15
Location
Spain
Website
9hitspoints.tk
Achievement
You can see class / id of close button of the pop-up.
Example, first page



As you can see this class of button is "soundest-form-background-image-close"
So we can do a
"ClickByClass("soundest-form-background-image-close ");"

But this "pop-up" apper a little time after page load so you need wait it.

-------------------
await WaitForLoading();
await Delay(10000);
ClickByClass("soundest-form-background-image-close ");
-------------------

That is a esay way to do something like this :)
 

davep2

New Member
VIP
Joined
Feb 26, 2019
Messages
35
Reaction score
1
Achievement
Thanks, just tested, that works.

By the way, how can i use macro to click a text link (which has no Id or Class or anything)?
 

davep2

New Member
VIP
Joined
Feb 26, 2019
Messages
35
Reaction score
1
Achievement
Why isn't it possible to copy/paste within the macro editor?
 

MauroS5

Administrator
Staff member
Rule The Galaxy
Joined
May 10, 2018
Messages
199
Reaction score
15
Location
Spain
Website
9hitspoints.tk
Achievement
Yes, you can copy/paste on macro editor o_o
But use "Ctrl + c" to copy and "Ctrl + v" to paste x)

If you want to click on a text link and this text dont have a class or id you can do it with ClickByXpath.
Example.

You have a text link to http://google.com
But this text dont have a id or class, then:

ClickByXpath(GenerateXpath("a", "href", "http://google.com"));

With that you are saying click where exist a link what will go to http://google.com
You can change "http://google.com" to where this text link redirect.

Also if link is soo long
Example:
https://www.google.com/search?q=gatito&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjk6f24kd3gAhVPhuAKHR8uCuMQ_AUIDigB&biw=1920&bih=947#imgrc=MW7aYzn83jkNyM

You can do this:
ClickByXpath(GenerateXpath("a", "href", "https://www.google.com/search?q=gatito&source=lnms%"));
Then this % means 9hits will click on link what start with this

I dont know if you understand me :/
 

davep2

New Member
VIP
Joined
Feb 26, 2019
Messages
35
Reaction score
1
Achievement
I understood, thank you so much for helping me out, i'm new to this and i'm learning. i was right-clicking with the mouse on the macro editor, that's why i assumed i couldn't copy/paste.
May i use this topic to ask more doubts i still have? You explain things very well!
 

davep2

New Member
VIP
Joined
Feb 26, 2019
Messages
35
Reaction score
1
Achievement
This website https://www.awscloudcertified.com has something blocking the sendmousewheel command from working, can you tell me what it is?
 

MauroS5

Administrator
Staff member
Rule The Galaxy
Joined
May 10, 2018
Messages
199
Reaction score
15
Location
Spain
Website
9hitspoints.tk
Achievement
Make sure you are usings commads well.
Example

await WaitForLoading();
await Delay(5000);
SendMouseWheel(0, -1000);

First you need put axis X and then Y
In most of case you want move down or up so:

SendMouseWheel(0, -1000); //To move down (-1000 is a example, use what you want)

SendMouseWheel(0, 1000); //To move up (1000 is a example, use what you want)
 

davep2

New Member
VIP
Joined
Feb 26, 2019
Messages
35
Reaction score
1
Achievement
I would like some more help if possible...

On this page https://www.imdb.com/name/nm0005069/ I can't for the life in me, make a macro click the "Producer" or "Director" or "Writer" links on top left of the page; or even the "see full bio" link at the end of the main text.

I tried several methods and different attributes but can't make the clicks work.

Any suggestions?
 

daniel

Administrator
Staff member
VIP
Joined
Feb 23, 2018
Messages
268
Reaction score
36
Achievement
pkmn post_id=1445 time=1555004839 user_id=424 said:
I would like some more help if possible...

On this page https://www.imdb.com/name/nm0005069/ I can't for the life in me, make a macro click the "Producer" or "Director" or "Writer" links on top left of the page; or even the "see full bio" link at the end of the main text.

I tried several methods and different attributes but can't make the clicks work.

Any suggestions?
Hi, you may try this. It would click random that 3 links
Code:
await WaitForLoading();
await Delay(3000);
var hrefs = ["#producer", "#director", "#writer"];
var xpath = GenerateXpath("a", "href", RandomArray(hrefs));
await ClickByXpath(xpath);
Thank maurosayan5, you have great experience at 9Hits ;)
 

davep2

New Member
VIP
Joined
Feb 26, 2019
Messages
35
Reaction score
1
Achievement
I see. Just tested and it works as it is, if loading the page directly.
BUT...
If i load a search engine page, look for the correct result link and click it, then your piece of macro no longer functions, or any other that i have tried.

Look at my macro and test it please:

WEBSITE: https://www.google.com/

await Delay(7000);
await ClickByXpath(GenerateXpath("input", "type", "text"));
await Delay(2000); //I want to wait a bit before typing
await Typing ("Spike Jonze");
await Delay(1000);
SendKeyPress(13);
await Delay(5000); //wait for results loading after press Enter
await ClickByXpath(GenerateXpath("a", "href", "%nm0005069%"));
await delay(10000);
var hrefs = ["#producer", "#director", "#writer"];
var xpath = GenerateXpath("a", "href", RandomArray(hrefs));
await ClickByXpath(xpath);

That is my real problem, why does that happen? How can i solve it?
 

MauroS5

Administrator
Staff member
Rule The Galaxy
Joined
May 10, 2018
Messages
199
Reaction score
15
Location
Spain
Website
9hitspoints.tk
Achievement
hahah this take me more time than I spected but "Everyday you learn something new" :lol:

The problem is this lane: await delay(10000);

Aparently if is a capital letter or a lowercase letter is important
So the only change is this "d" for "D"
"await Delay(10000);"

So the code is:
Code:
await WaitForLoading();
await ClickByXpath(GenerateXpath("input", "type", "text"));
await Delay(2000);
await Typing ("Spike Jonze");
await Delay(1000);
SendKeyPress(13);
await Delay(5000);
await ClickByXpath(GenerateXpath("a", "href", "%nm0005069%"));
await Delay(1000);
await WaitForLoading();
var hrefs = ["#producer", "#director", "#writer"];
var xpath = GenerateXpath("a", "href", RandomArray(hrefs));
await ClickByXpath(xpath);
"await WaitForLoading();"
This is a little change to make this faster because if page load faster that expected they will click when page load and dont waste time.
But if you dont like it just change this "d" of your code and it will works fine ;)

@Daniel, But for the moment you make a lot of better scripts than me haha :D
 

davep2

New Member
VIP
Joined
Feb 26, 2019
Messages
35
Reaction score
1
Achievement
Just checked, it works! Man, how a tiny thing can mess everything up... I bet i have done some errors like that in the past...
Thank you both Daniel and Maurosayan5 for always being here helping me out!
 

MauroS5

Administrator
Staff member
Rule The Galaxy
Joined
May 10, 2018
Messages
199
Reaction score
15
Location
Spain
Website
9hitspoints.tk
Achievement
haha. We are here to help :D
Also Im not a god of macro, just learning at same time I make macros :)
 

davep2

New Member
VIP
Joined
Feb 26, 2019
Messages
35
Reaction score
1
Achievement
Is it possible to (how can i explain this...), instead of telling the macro exactly what to write like await Typing ("Spike Jonze");
tell it to write something random, OR, write a different value from a preset list, everytime it is needed? So that everytime the macro types it will always be a different input value.
Is this something doable?
 

daniel

Administrator
Staff member
VIP
Joined
Feb 23, 2018
Messages
268
Reaction score
36
Achievement
pkmn post_id=1468 time=1555315235 user_id=424 said:
Is it possible to (how can i explain this...), instead of telling the macro exactly what to write like await Typing ("Spike Jonze");
tell it to write something random, OR, write a different value from a preset list, everytime it is needed? So that everytime the macro types it will always be a different input value.
Is this something doable?
Code:
var texts = ["Text 1", "text 2", "text 3", "text N"];
await Typing(RandomArray(texts));
 

davep2

New Member
VIP
Joined
Feb 26, 2019
Messages
35
Reaction score
1
Achievement
I have another situation at the back of my head...

If i program a macro to click a link which is a "nofollow" link, in other words, will open a new tab/window/pop-up, is it possible to make the macro continue on that pop-up and not on the main window as it was? Thanks in advance.
 

MauroS5

Administrator
Staff member
Rule The Galaxy
Joined
May 10, 2018
Messages
199
Reaction score
15
Location
Spain
Website
9hitspoints.tk
Achievement
await TabFocus();
Is you way
If you know where address will send you this popup (google for example)
Then put await TabFocus("google.com");
If you dont know where this popup will send you but you know site will only open a single pupup
Then you can use await TabFocus(1);
And this will focus first popup, 2 second etc....
 

davep2

New Member
VIP
Joined
Feb 26, 2019
Messages
35
Reaction score
1
Achievement
I still haven't tried personally, nor do i still understand it right, but can we program a macro to solve the modern captchas we see all around the web? Or bypass it somehow?
 

MauroS5

Administrator
Staff member
Rule The Galaxy
Joined
May 10, 2018
Messages
199
Reaction score
15
Location
Spain
Website
9hitspoints.tk
Achievement
If you are asking about reCAPTCHA you have 2captcha commands to do that.
Is little hard but we are here :)

https://forum.9hits.com/viewtopic.php?f=8&t=55
 

About us

  • Our community has been around for many years and pride ourselves on offering unbiased, critical discussion among people of all different backgrounds. We are working every day to make sure our community is one of the best.

Quick Navigation

User Menu