fate0 / pychrome

A Python Package for the Google Chrome Dev Protocol [threading base]
Other
612 stars 112 forks source link

Simulate clicks? #44

Open TimeAshore opened 5 years ago

TimeAshore commented 5 years ago

When sending POST requests, you need to carry parameters. So, Can you skip this part and directly simulate clicks?

Thanks, Sincerely.

TimeAshore commented 5 years ago

I got it! But.. how to enter text in the page input box, which part of the Chrome DevTools Protocol?

Tindome commented 4 years ago

i don't know if it could help you but i proceed like that for an identification form by example my example is a bit complex because the fields have events on them so i need to really dispatch mouseevent select with css the node of the field find the localisation x,y of the field (because click need them) use click method of devtools protocol on it (2 * dispatchMouseEvent one for "mousePressed" and one for "mouseReleased") wait 0,1 ssec check if the node is of type input, if so use select() method to reset it use sendText method of node element

TimeAshore commented 4 years ago

i don't know if it could help you but i proceed like that for an identification form by example my example is a bit complex because the fields have events on them so i need to really dispatch mouseevent select with css the node of the field find the localisation x,y of the field (because click need them) use click method of devtools protocol on it (2 * dispatchMouseEvent one for "mousePressed" and one for "mouseReleased") wait 0,1 ssec check if the node is of type input, if so use select() method to reset it use sendText method of node element

thanks!

Tindome commented 4 years ago

i have realize a wrapper for pychrome which help use it by keeping verb like those used in selenium if anybody interested

TimeAshore commented 4 years ago

which

Tindome commented 4 years ago

i will add it to my repo as soon as i could (really busy at works) it was an early preview (working for my need but could have some bugs)

woshichuanqilz commented 4 years ago

I got it! But.. how to enter text in the page input box, which part of the Chrome DevTools Protocol?

Can you give me a example about click an element?