kaliiiiiiiiii / Selenium-Driverless

undetected Selenium without usage of chromedriver
https://kaliiiiiiiiii.github.io/Selenium-Driverless/
Other
545 stars 66 forks source link

Startup blocks Ubuntu 20.04 server #151

Closed JimKarvo closed 8 months ago

JimKarvo commented 8 months ago

I am trying to run he examle code

from selenium_driverless import webdriver
from selenium_driverless.types.by import By
import asyncio

async def main():
    print("main")
    options = webdriver.ChromeOptions()
    print("options")
    async with webdriver.Chrome(options=options) as driver:
        print("driver")
        await driver.get('http://nowsecure.nl#relax')
        await driver.sleep(0.5)
        await driver.wait_for_cdp("Page.domContentEventFired", timeout=15)

        # wait 10s for elem to exist
        elem = await driver.find_element(By.XPATH, '/html/body/div[2]/div/main/p[2]/a', timeout=10)
        await elem.click(move_to=True)

        alert = await driver.switch_to.alert
        print(alert.text)
        await alert.accept()

        print(await driver.title)

asyncio.run(main())

At linux server (Ubuntu 20.04), with no luck. the code is stuck after async with webdriver.Chrome(options=options) as driver:

Is it possible somehow to run it?

kaliiiiiiiiii commented 8 months ago
  1. Please provide tho output with webdriver. Chrome(debug=True, ...)
  2. What chromium or Chrome version do you've got installed.
  3. Is there a desktopmanager running? If yes, which one?
JimKarvo commented 8 months ago

The problem of not running solved with --no-sandbox

options = webdriver.ChromeOptions()
    arguments = [
        "--no-sandbox",
        "--headless=new"
        "--incognito"
    ]

    for argument in arguments:
        options.add_argument(argument)

1) The log is attached below! 2) I use Google Chrome 120.0.6099.224 3) I haven't installed any desktopmanager, may I have to try any?

DevTools listening on ws://127.0.0.1:51571/devtools/browser/e1e9b131-1805-42ef-b869-bfec76b9cffc
[0117/221231.867312:WARNING:bluez_dbus_manager.cc(248)] Floss manager not present, cannot set Floss enable/disable.
[0117/221231.886244:WARNING:sandbox_linux.cc(400)] InitializeSandbox() called with multiple threads in process gpu-process.
[0117/221232.091335:INFO:CONSOLE(0)] "Error with Permissions-Policy header: Origin trial controlled feature not enabled: 'browsing-topics'.", source:  (0)
[0117/221232.091361:INFO:CONSOLE(0)] "Error with Permissions-Policy header: Origin trial controlled feature not enabled: 'interest-cohort'.", source:  (0)
[0117/221232.375258:INFO:CONSOLE(0)] "Error with Permissions-Policy header: Origin trial controlled feature not enabled: 'browsing-topics'.", source:  (0)
[0117/221232.375277:INFO:CONSOLE(0)] "Error with Permissions-Policy header: Origin trial controlled feature not enabled: 'interest-cohort'.", source:  (0)
[0117/221232.983344:ERROR:object_proxy.cc(577)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[0117/221232.983360:WARNING:property.cc(144)] DaemonVersion: GetAndBlock: failed.
[0117/221232.983508:ERROR:object_proxy.cc(577)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[0117/221232.983658:ERROR:object_proxy.cc(577)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[0117/221233.000041:INFO:CONSOLE(1)] "Request for the Private Access Token challenge.", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.000170:INFO:CONSOLE(1)] "The next request for the Private Access Token challenge may return a 401 and show a warning in console.", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.025800:INFO:CONSOLE(1)] "console.groupEnd", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.238281:INFO:CONSOLE(1)] "BMIP", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.238313:INFO:CONSOLE(1)] "BMIP", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.242287:INFO:CONSOLE(1)] "[object HTMLAnchorElement]", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.242313:INFO:CONSOLE(1)] "[object HTMLAnchorElement]", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.242323:INFO:CONSOLE(1)] "%c%d: 1", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.242333:INFO:CONSOLE(1)] "%c%d: 1", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.243100:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent NaN", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.243120:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent NaN", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.243128:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent ", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.243147:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent ", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.243157:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent ", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.245293:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent ", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.245320:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent NaN", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.245328:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent NaN", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.245332:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent NaN", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.245343:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent NaN", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.245347:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent NaN", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.245356:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent NaN", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.245367:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent ", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.245375:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent ", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.245380:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent NaN", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.245388:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent NaN", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.245393:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent NaN", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.245401:INFO:CONSOLE(1)] "%c%d font-size:0;color:transparent NaN", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221233.246097:INFO:CONSOLE(1)] "console.groupEnd", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/orchestrate/chl_api/v1?ray=847140ee2e17d943 (1)
[0117/221236.655653:INFO:CONSOLE(0)] "The resource https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/cmg/1/thjDJDzWtvkZXGRuO4R2mDCpnM0eKVs1%2FJa8pTE7oJo%3D was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/b/turnstile/if/ov2/av0/rcv0/0/yeap7/0x4AAAAAAADnPIDROrmt1Wwj/light/normal (0)