-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't launch in Google Colab #2778
Comments
Duplicate of #2030 (comment) That's a popular issue from To get around that, use the from seleniumbase import SB
with SB(uc=True, test=True) as sb:
url = "https://gitlab.com/users/sign_in"
sb.driver.uc_open_with_reconnect(url, 3)
if not sb.is_text_visible("Username", '[for="user_login"]'):
sb.driver.uc_open_with_reconnect(url, 4)
sb.assert_text("Username", '[for="user_login"]', timeout=3)
sb.assert_element('label[for="user_login"]')
sb.highlight('button:contains("Sign in")')
sb.highlight('h1:contains("GitLab.com")')
sb.post_message("SeleniumBase wasn't detected", duration=4) You could also use SeleniumBase's Here's an example script using that format: (https://github.com/seleniumbase/SeleniumBase/blob/master/examples/verify_undetected.py) from seleniumbase import BaseCase
BaseCase.main(__name__, __file__, "--uc", "-s")
class UndetectedTest(BaseCase):
def test_browser_is_undetected(self):
url = "https://gitlab.com/users/sign_in"
if not self.undetectable:
self.get_new_driver(undetectable=True)
self.driver.uc_open_with_reconnect(url, 3)
if not self.is_text_visible("Username", '[for="user_login"]'):
self.get_new_driver(undetectable=True)
self.driver.uc_open_with_reconnect(url, 4)
self.assert_text("Username", '[for="user_login"]', timeout=3)
self.post_message("SeleniumBase wasn't detected", duration=4)
self._print("\n Success! Website did not detect Selenium! ") Use |
Thank you for your reply, I really appreciate it. My code:
Error:
|
Where is Chrome installed on that machine? It might not be in the default location (if it's installed at all). Use If you're using the Also try |
@megalevel Sorry, did you manage to run seleniumbase on colab? |
Someone from the SeleniumBase Discord server got it working on Google Colab with: from seleniumbase import SB
import subprocess
import nest_asyncio
nest_asyncio.apply()
# Start an Xvfb session
subprocess.run(['xvfb-run', '-a'])
from seleniumbase import SB
with SB(uc=True, test=True, headed=True, locale_code="en") as sb:
sb.activate_cdp_mode(URL)
# ... |
Hello!
I am trying to execute the code in the Google Colab environment, but I get an error. My code:
Error:
Please help!
The text was updated successfully, but these errors were encountered: