Coder Social home page Coder Social logo

Comments (4)

stevepryde avatar stevepryde commented on July 21, 2024

Please show the rust code you're using for the connection as well

from thirtyfour.

 avatar commented on July 21, 2024

from thirtyfour.

stevepryde avatar stevepryde commented on July 21, 2024

There's no image attached. Please just paste the code as text

from thirtyfour.

stevepryde avatar stevepryde commented on July 21, 2024

I've tried with selenium docker images like this:

docker run -d -p 4444:4444 --shm-size="2g" selenium/standalone-chrome:4.9.1-20230508

Then connecting like this works:

let caps = DesiredCapabilities::chrome();
let driver = WebDriver::new("http://localhost:4444", caps).await?;

When I tried with the debian image like your dockerfile I get this:

0: error creating new session: webdriver server gave non-conformant response: Object {"error": String("unknown error"), "message": String("unknown error: Chrome failed to start: exited abnormally.\n  (unknown error: DevToolsActivePort file doesn't exist)\n  (The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)"), "stacktrace": String("#0 0x55b68ab4b2c3 <unknown>\n#1 0x55b68a86fca8 <unknown>\n#2 0x55b68a899e3b <unknown>\n#3 0x55b68a895bc8 <unknown>\n#4 0x55b68a8dc4be <unknown>\n#5 0x55b68a8d3eb3 <unknown>\n#6 0x55b68a8a0d7e <unknown>\n#7 0x55b68a8a2112 <unknown>\n#8 0x55b68ab19bf6 <unknown>\n#9 0x55b68ab1d93d <unknown>\n#10 0x55b68ab1d3d6 <unknown>\n#11 0x55b68ab1dde5 <unknown>\n#12 0x55b68ab245bb <unknown>\n#13 0x55b68ab1e166 <unknown>\n#14 0x55b68aaf3a96 <unknown>\n#15 0x55b68ab37a25 <unknown>\n#16 0x55b68ab37bce <unknown>\n#17 0x55b68ab4581f <unknown>\n#18 0x7f79442c3ea7 start_thread\n"), "data": Null}

So I googled and it turns out you need the --no-sandbox option enabled.

So this code works (which is roughly equivalent to the python code you posted):

let mut caps = DesiredCapabilities::chrome();
caps.set_no_sandbox().unwrap();
caps.set_disable_dev_shm_usage().unwrap();
caps.set_headless().unwrap();
let driver = WebDriver::new("http://localhost:9515", caps).await?;

from thirtyfour.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.