#I Could need help here im new to Python
206 messages · Page 1 of 1 (latest)
@grim coral
For safety reasons we do not allow files with certain file extensions.
You can share your code using triple backticks like this:
```
YOUR CODE
```
For longer scripts use Hastebin or GitHub Gists and share the link here
Selenium trash moment
But yeah we need full code kek
Probably an issue with scrolling
Just fyi, viewbotting is against tos and viewbotting with Selenium is a bad idea, you'll spend more on servers than you could ever make from renting the bot out 🙂
yeah but like I said not mine and im new to Python 😬 but I can send full code
@grim coral
For safety reasons we do not allow files with certain file extensions.
You can share your code using triple backticks like this:
```
YOUR CODE
```
For longer scripts use Hastebin or GitHub Gists and share the link here
- message.txt
Can you read?
My friends cat's dog wrote my code, my guess is that you either didn't scroll to the element (i.e. the target element is not in the viewport)
I dont understand what you mean
fr
Damn we just copying code from github and putting our name in the title bar now
Very nice
Ah
Instead of trying to do jokes about me or smth you could just help me
Or did I say any bad
Yes it's against tos but whatever
The issue is that the original author also doesn't know Python
So basically in line 119
The thing is it worked like 1-2 months ago
but now it doesnt anymore
after I resetted my pc
It's broken for all of the funny proxies you have in there, correct?
yes
A sleep between line 117 and 119 would probably be enough
(you can figure out how to sleep in Python on your own, I believe in you)
But the application probably won't scale much beyond like 10 or 15 viewers
You could use all of the proxies at the same time but even then it'd be pretty resource-intensive
Yeah I tried and it worked like 20-30 without lags
😳
did it like this now
dont know if its right but its still not working
You have any other idea?
I'd suggest to get rid of the --headless flag in line 107 so you can see what it's doing
Maybe you have to accept the funny GDPR cookie banner first
Can you click on the URL bar without accepting cookies?
Open the dev tools
Ctrl + Shift + I
Clicc through the funny HTML and locate the cookie accept button
(Copy XPath or it's ID then driver.find_element by id or by xpath that element and then element.clicc it)
So I know what you mean but I don't know how to implement it
Could you help me there?
First I dont know how to find out the button. I mean its like this rn but im not sure if I do it right
That's the button
Now you just gotta figure out how to target that button
It doesn't have a nice CSS class like the URL input, but you could still right click it in the HTML explorer in the dev tools and copy the XPath
what do you mean with XPath?
Right click copy as xpath
xpath is some magic way of identifying things in other XML or HTML documents
So now you go back to thec ode
before punching stuff into the url field you clicc the button first
"selenium click button by xpath python" on Google -> copy pasta
Somewhere between sleeping (aka waiting for the page to load) and clicking the button so exactly there, yes
I'd probably go with the second approach but whatever
Now try running again and see if it automagically accpets cookies
Oh damn they removed that method
Haven't used Selenium in years, apparently they removed it in 2022 or so
driver.find_element("xpath", "some/xpath/here") should work though
Can you drop the link to the proxy in here? I want to take a look at the HTML myself
But it looks like something's wrong with the XPath
lol I don't even get the funny cookie banner
nice
Ah nevermind I have a magic firefox extension that just nukes all of those cookie banners
In chrome it's bitching to me again
yea that
You probably want to click the actual button and not the text inside of the button
/html/body/div[8]/div[2]/div[1]/div[2]/div[2]/button[1]
So this one maybe
So does the form show up in time?
wdym
Does it try to click before the consent form is visible?
How can i see/check it?
add more sleeps and more prints 🗿
It'll crash in the first one
I'm saying you run the script and see if it pops up in time
Go ahead
after the browser open it opens the website
after opening the website it opens a new tab with the same website
than it pops up (the cookie thing)
and after like 5-10 seconds it crashes and shows me error code
So we open the website, open the new tab (driver.execute_script... and driver.switch_to.window(...))
So it's still not finding the cookie magic for some reason
You're running driver.find_element(xpath)
but it should be like this
with the xpath being the second argument
Yup
Still not working
Why?
So cookie issue is solved
Now let's see why it crashes now
Do you still try to click the button multiple times? Is the button gone now that you have clicked it once?
Not sure how Selenium on Windows handles browser profiles
it needs like 6 seconds for the cookies to be gone
Because of the sleep(5)?
Probably breaks on the second tab because there's no cookie popup there?
Exactly what I said, no?
nah not really
wait ill explain in 2 min
so if i say 2 viewers not 1 it opens 2 windows yk not tabs
but it only works for 1 window
if i say i want 10 viewers it crashes
Does it show the cookie popup again in the new windows, or only in the first one?
ah wait i daid it wrong
its not opening windows its opening tabs sorry for missunderstanding
on the first tab its doing nothing
on the second its going right
the third one is just doing nothing but doesnt have cookies
Which is exactly what I said here
yes ik sorry mb
You only need to close the cookie popup in the first tab
uh wdym now
and its only opening 3 tabs
if i put 10 viewers its still 3 tabs
and crashes than
crashes than
if i do it
what should I do now
so
i did 2 now
on one tab it accepts cookies and works
the other one doesnt have cookies than
but just crashes
How'd you modify the code?
Thats everything
looks like exactly the same code you had before
What should I change
What code did you change
only this
.
What code changes did you make after I said this
Nothing actually
What should i change?
Did you read any of my previous messages?
.
You mean this
right?
But now
Do you mean to change it in code our do i have to close the cookies by myself
Whatever you prefer
hey i can help!
then help lol
Python is not supposed to be packed into .exe files
Because it's not made to ship executables to end users
