Closed ahihiyou20 closed 4 weeks ago
The page was fully loaded also
The page was fully loaded also
This is usually for example when the page is in a reload-loop.
Closing this bug for now as you haven't provided a minimum reproducible script and without it,. there's no way to fix it for me.
Ofc I'm willing to have a look and re-open it if you provide that.
@kaliiiiiiiiii Here is my code
options = webdriver.ChromeOptions()
topgg = "top.gg" # https://top.gg is the page i'm talking about, this is not the actual url that I'm visiting, but it will eventually redirect to this "top.gg" with some cookies (connect.sid for example)
async with webdriver.Chrome(options=options) as driver:
await driver.get(topgg, wait_load=True, timeout=10)
await asyncio.sleep(5)
button = await driver.find_element(
by=By.XPATH, value='//a[@href="/bot/408785106942164992/vote"]'
)
await button.click(ensure_clickable=True, scroll_to=True)
await asyncio.sleep(10)
button = await driver.find_element(
by=By.XPATH, value=".//button[contains(text(),'Vote')]"
)
await button.click(ensure_clickable=True)
await asyncio.sleep(3)
What is a reload-loop actually? And why does this affect only my other PC and not the one I wrote the code? Given the almost identical conditions
@kaliiiiiiiiii Here is my code
options = webdriver.ChromeOptions() topgg = "top.gg" # https://top.gg is the page i'm talking about, this is not the actual url that I'm visiting, but it will eventually redirect to this "top.gg" with some cookies (connect.sid for example) async with webdriver.Chrome(options=options) as driver: await driver.get(topgg, wait_load=True, timeout=10) await asyncio.sleep(5) button = await driver.find_element( by=By.XPATH, value='//a[@href="/bot/408785106942164992/vote"]' ) await button.click(ensure_clickable=True, scroll_to=True) await asyncio.sleep(10) button = await driver.find_element( by=By.XPATH, value=".//button[contains(text(),'Vote')]" ) await button.click(ensure_clickable=True) await asyncio.sleep(3)
What is a reload-loop actually? And why does this affect only my other PC and not the one I wrote the code? Given the almost identical conditions
@ahihiyou20 the identifier 408785106942164992
looks to me like it could be dynamic and randomly generated, therefore not found in every case. Maybe try a different selector.
@kaliiiiiiiiii That number is called an ID, which will never change, if you visit that site you will guarantee to find a button with that specific href Yes, my issue is still occurring with that specific code, I have no idea what’s the issue behind It seems that the issue is dependent on the device since it worked fine to me when it’s not on another computer. With the almost identical site content (it rarely changes). If you want further investigation or debugging, I can provide you with screenshots, videos of the process
Also what selector should I use? The button I’m looking for have duplicates and contains the same content (text) and css styling. The only thing that varies seem to be the href or that link I’m using. What selector should I use in that case?
Or is there anyway to use driver.get() and preserve all the cookies since every time I use it Cloudflare just blocks me on the second attempt when I try to go to /bot/408785106942164992/vote, It may seem like its lack of cookies caused the issue and I have to manually click a button to visit that endpoint
alr let's re-open for now then
@kaliiiiiiiiii I tried the same code again today and I found it interesting that it worked for the first button, the second button failed still but somehow it worked for the first without any modification. The site is still the same At this point I don’t really know it’s the site’s issue or mine anymore
Actually I found out that I was using multiple threads with Threading, automating the same site. Which caused the problem, it worked fine with 1 thread So is there anyway to use this library with multiple threads? I was creating driver.Chrome() everytime a thread needs
Actually I found out that I was using multiple threads with Threading, automating the same site. Which caused the problem, it worked fine with 1 thread So is there anyway to use this library with multiple threads? I was creating driver.Chrome() everytime a thread needs
don't re-use the ChromeOptions
I opened a prior issue about this with headless being on. I eventually solved it with options.headless instead of adding arguments. However I encountered a new issue with driver.find_element WITHOUT HEADLESS on another computer
Recreating
On my computer it worked perfectly but on another it didn’t even with the latest chrome and same operating system (win10) To clarify, the page didn’t get blocked by cloudflare, it is protected by cloudflare tho. It loaded fine and with the same conditions as my computer did. But it just refuses to find the button