seleniumbase / SeleniumBase

📊 Blazing fast Python framework for web crawling, scraping, testing, and reporting. Supports pytest. Stealth abilities: UC Mode and CDP Mode.
https://seleniumbase.io
MIT License
5.4k stars 979 forks source link

Detailed Explanation and Usage of Website Connection Options and Parameters #2896

Closed PankajSavaliya closed 4 months ago

PankajSavaliya commented 4 months ago

Can you please explain these options in detail and when they should be used? There are many options available to load a website, connect, and disconnect, but why are these options available? I would also like to understand reconnect_time, timeout, and each feature so I can use them precisely.

I'm using this SB with multi-threading as per your document with UC so please give me the proper document for that way.

driver = Driver(uc=True, agent=generate_random_mobile_user_agent(False), )

  1. driver.uc_open(url)

  2. driver.uc_open_with_tab(url)

  3. driver.uc_open_with_reconnect(url, reconnect_time=None)

  4. driver.uc_open_with_disconnect(url, timeout=None)

  5. driver.reconnect(timeout)

  6. driver.disconnect()

  7. driver.connect()

mdmintz commented 4 months ago

The UC Mode docs are here: SeleniumBase/help_docs/uc_mode.md

And those methods are described in detail in the UC Mode video tutorials:


(Watch the 1st UC Mode tutorial on YouTube! ▶️)

----

(Watch the 2nd UC Mode tutorial on YouTube! ▶️)

---- Disconnecting the driver from Chrome makes Selenium less detectable during that time. ```python # "driver"-specific methods added (or modified) by SeleniumBase for UC Mode: driver.get(url) # If UC Mode and site detects bots, then uc_open_with_tab(url) driver.uc_open(url) # (Open in same tab with default reconnect_time) driver.uc_open_with_tab(url) # (New tab with default reconnect_time) driver.uc_open_with_reconnect(url, reconnect_time=None) # (New tab) driver.uc_open_with_disconnect(url, timeout=None) # New tab + sleep() driver.reconnect(timeout) # disconnect() + sleep(timeout) + connect() driver.disconnect() # Stops the webdriver service to prevent detection driver.connect() # Starts the webdriver service to allow actions again driver.uc_click(selector) # A stealthy click for evading bot-detection driver.uc_gui_press_key(key) # Use PyAutoGUI to press the keyboard key driver.uc_gui_press_keys(keys) # Use PyAutoGUI to press a list of keys driver.uc_gui_write(text) # Similar to uc_gui_press_keys(), but faster driver.uc_gui_handle_cf(frame="iframe") # PyAutoGUI click CF Turnstile ```
PankajSavaliya commented 4 months ago

@mdmintz in which these methods should be used? (Connect, Reconnect, and Disconnect) and when for undetection?

PankajSavaliya commented 4 months ago

@mdmintz in which these methods should be used? (Connect, Reconnect, and Disconnect) and when for undetection?

@mdmintz can you please explain when these methods should be called and which case? like click, and scroll.

mdmintz commented 4 months ago

@PankajSavaliya You've been spamming the SeleniumBase GitHub repo with lots of duplicate and/or off-topic comments in a short period of time. That's definitely unacceptable behavior, and grounds for getting blocked.

Screenshot 2024-07-08 at 9 56 57 AM

That's in violation of SeleniumBase Terms of Service policies, eg: https://github.com/seleniumbase/SeleniumBase/issues/2249. You'll be blocked for your actions.

GitHub repo maintainers are not your personal task-rabbits. Maintainers lead busy lives, and we don't always have time to respond to messages in a timely fashion. People should be respectful of GitHub repo maintainers. Those who cannot be respectful have no place here.