Selenium base UC mode: find_element work but find_elements doesn't #3091
-
Hi, trying out the UC mode on linux machine (Chrome ver 117.0.5938.92) to scrape some public links.
May I know what else could be a potential cause in such scenario? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
SeleniumBase uses a good user-agent by default. It's possible that you gave it a bad one that will detect your bot. It's best to leave it as the default value. Also, For opening URLs in stealth mode, use Assuming the selector is correct, |
Beta Was this translation helpful? Give feedback.
-
Thank you! Works as expected now |
Beta Was this translation helpful? Give feedback.
SeleniumBase uses a good user-agent by default. It's possible that you gave it a bad one that will detect your bot. It's best to leave it as the default value. Also,
uc_subprocess
doesn't change anything anymore, so you shouldn't need to use it.For opening URLs in stealth mode, use
uc_open_with_reconnect(url, reconnect_time)
, wherereconnect_time
is a time (in seconds) that is longer than the time it takes to finish loading the URL you want to navigate to. eg:uc_open_with_reconnect(url, 4)
. Then, you don't need to usesb.wait_for_ready_state_complete()
.Assuming the selector is correct,
sb.find_elements(selector)
returns a list of WebElements. Then extract the link from each one.