I have been using selenium to access a website that has employed anti bot protection. I have discovered SeleniumBase and have found that it has solved my problem. Originally i was thinking that i could use SeleniumBase to proceed past the trouble and then revert back to my selenium to complete the activity. That would save me a lot of time re-coding. However, i am having trouble synching up the selenium activities with the SeleniumBase statements that precede them. I am getting a lot of catching classes that do not inherit from BaseException is not allowed error messages and am also having trouble finding elements by css selector and xpath. I have been using selenium for years so i am pretty good at getting this information.
Is there somewhere that i can go to see code or documentation that would help with my desire to integrate and use the two libraries in a cooperative manner.
Thanks in advance
Documentation for the different SeleniumBase formats can be found here: SeleniumBase/help_docs/syntax_formats.md
The SeleniumBase driver
includes the original driver
methods, plus new ones (including some special ones for UC Mode).
Here's a format that works directly from the driver
:
from seleniumbase import Driver
driver = Driver(uc=True)
try:
driver.open("https://seleniumbase.io/simple/login")
driver.type("#username", "demo_user")
driver.type("#password", "secret_pass")
driver.click('a:contains("Sign in")')
driver.assert_exact_text("Welcome!", "h1")
driver.assert_element("img#image1")
driver.highlight("#image1")
driver.click_link("Sign out")
driver.assert_text("signed out", "#top_message")
finally:
driver.quit()
Here are some driver methods added specifically for UC Mode:
driver.uc_open(url)
driver.uc_open_with_tab(url)
driver.uc_open_with_reconnect(url, reconnect_time=None)
driver.reconnect(timeout)
driver.uc_click(selector)
driver.uc_switch_to_frame(frame)