Open 400ochkov opened 3 months ago
I've published a new version 0.3.0-alpha.1
to NuGet which hopefully fixed this issue (commit https://github.com/GerardSmit/GhostCursor/commit/abc47b46c27e5681c38d9446f449184aaec48b0a).
It's a quick and dirty solution for now. Can you check if this version fixes the problem for you?
Looks like doesnt work. Made as usual await cursor.MoveToAsync(478, 743); and faced exception:
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object. at GhostCursor.PuppeteerSharp.PuppeteerBrowserBase.GetViewportAsync(CancellationToken token) at GhostCursor.Cursor
2.GetRandomPointAsync(BoundingBox boundingBox) at GhostCursor.Cursor
2.MoveToAsync(BoundingBox boundingBox, Nullable1 steps, Nullable
1 moveSpeed, PositionType type, CancellationToken token) at Program.Test(Int32 taskId, ProxyManager proxyManager) in C:\Users\user\source\repos\puppeteer\Program.cs:line 267 at Program.<>c__DisplayClass7_1.<b__0>d.MoveNext() in C:\Users\user\source\repos\puppeteer\Program.cs:line 179 --- End of stack trace from previous location --- at Program.Main(String[] args) in C:\Users\user\source\repos\puppeteer\Program.cs:line 199 at Program. (String[] args)
Huh, that's weird. In another issue there was this problem as well (https://github.com/GerardSmit/GhostCursor/issues/1#issuecomment-1902254344) because the page wasn't initialized but I sadly can't reproduce this.
I made a unit test from this issue and it's passing. Do you have a small repo when this issue happens?
I understood. There is problem with DefaultViewport when connect to browser If I set like this it works
ViewPortOptions DefaultViewport = new ViewPortOptions();
string ws = "ws://127.0.0.1:56344/devtools/browser/a756184a-820f-4b4f-8417-9d8119c13ad0";
var browser = await Puppeteer.ConnectAsync(new ConnectOptions
{
BrowserWSEndpoint = ws,
DefaultViewport = DefaultViewport
//ProtocolTimeout = 40000
});
But if I made defaultviewport null it doesnt work. I work with antidetect browser so set defaultviewport null
ViewPortOptions DefaultViewport = new ViewPortOptions();
DefaultViewport = (ViewPortOptions)null;
string ws = "ws://127.0.0.1:56344/devtools/browser/a756184a-820f-4b4f-8417-9d8119c13ad0";
var browser = await Puppeteer.ConnectAsync(new ConnectOptions
{
BrowserWSEndpoint = ws,
DefaultViewport = DefaultViewport
//ProtocolTimeout = 40000
});
Thank you for fix anyway. But may be there is use GhostCursor with null viewport?
I see, thanks for the repo. I've made a change that falls back to a JavaScript implementation of getting the viewport (https://github.com/GerardSmit/GhostCursor/commit/f1e05cdfdfd2174cea795e29f6beb4859543a674). This has been published to NuGet with version 0.3.0-alpha.2
.
Hello, I work with PuppeteerSharp and face this issue, when I made MoveToAsync pointer moved not exactly to my coordinates, it made +-5% dispersion from my coordinates For example I made this method on website https://www.selenium.dev/selenium/web/mouse_interaction.html which shows mouse position: await cursor.MoveToAsync(478, 743); and see that it moved not to 478, 743 but to 490, 750
Is it possible to fix this issue?
also same issue with await cursor.ClickAsync(478, 743); it moves pointer not to exactly these coordinates so make missclick