-
Notifications
You must be signed in to change notification settings - Fork 322
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
Compatibility with Centos 6? #98
Comments
Another thing I noticed is dusk doesn't seem to be starting up chromedriver properly when I run EDIT: EDIT2: |
I'm trying on Centos 7 and facing the same problems as you. How did you run it on Firefox? |
@deleugpn
Yum gave me an old version of firefox, 45.7. If you use newer versions, I believe you would need to use geckodriver (https://github.com/mozilla/geckodriver). Just download the appropriate build and run selenium with it
Hope that helps, and hopefully it runs better for you. Selenium + firefox still takes 15+ seconds for every page load for me :( |
I managed to run Dusk on Cent OS 7. I hope you can do the same on Cent OS 6. After installing Chromium Browser, you just need to create a separate user (NOT ROOT), turn on the Xvfb and run dusk as not root as well. If you want to run it specifically as root, you can try to run it with the arguments
|
@deleugpn I tried updating my docker environment to Centos 7 and while that helped make running chromedriver much more easier, I still end up with similar "Operation timed out after 30001 milliseconds with 0 out of -1 bytes received" errors |
Check file permission, try to run the driver manually (confirm it's listening to port 9515) and check if you have Xvfb set. |
So I've tried the following:
Not sure why chrome shows up twice but I can confirm that chromedriver is running under port 9515 since running a second instance manually would give me the "address already in use" message. Tests I have take 30 or more seconds each, timing out at the end EDIT: |
Set it up in a way that only one test will be executed (to speed things up). You can take advantage of
This will probably be enough time for Chrome Driver to actually tell you what is wrong. You can also try removing the retry completely for the purpose of this testing. The goal is to not rely on Facebook Webdriver's timeout settings. You want to let the application run until Chrome Driver gives you an error. |
Interesting, I increased the timeout with your suggestion and I do see a clearer error: |
I plan on writing a Medium post about this, but to sum it all up: Chrome Driver implements a HTTP protocol that Facebook Webdriver uses to manipulate the browser. As any HTTP Request, Facebook Webdriver relies on 30 seconds timeout. If you forget about Dusk completely, you can start chromedriver manually and then call it yourself through Postman (map your host machine with your guest machine through a access port). Then you can call something like Basically this was the way that I used to debug everything. Do straight with POSTMAN + Chrome Driver with output logs and you'll be able to see what Chrome Driver is telling you. I remember going through the crash situation, I think it was indeed chrome installation. I think I ended up making a symbolic link for chrome on After you learn how to manipulate Chrome Driver yourself, it's a piece of cake to understand how Dusk interacts with Facebook Webdriver to create an easy API for us to test the application. |
So it seems that chromedriver, according to it's logfile, gets stuck trying to do a DevTools request to
I read that these warnings can be ignored, but chromedriver still hangs repeatedly trying to do that DevTools request earlier. |
I finally got it to work. For some reason, it seems like some fonts were needed so I had to run the following:
Got the tip from here https://www.centos.org/forums/viewtopic.php?f=48&t=60908&start=10#p257122 I also need to use the --no-sandbox option. I could not get it to work without that option, even with a non-root user. |
Did you install Chromium Browser instead of actual Google Chrome? Chromium Browser is supported by Google for RedHat while Google Chrome is a 3rd-party adaptation. |
I installed google-chrome first (used the same script I previously needed to get chrome on Centos 6, https://chrome.richardlloyd.org.uk/). I then tried to install Chromium to see if I run into problems running it and got the same font errors as described in the centos.org link/post I put up. So I installed those fonts and now I'm able to get chromedriver to work with google-chrome. So no, I'm not using Chromium Browser at the moment. |
I think I was only able to run Chromium without the sandbox flag, not Chrome. |
@deleugpn I'm sorry if this isn't related to the issue, but I have a question for you. I believe you use Dusk with the internal PHP webserver correct? If so, would you happen to know of any workarounds when needing to make requests to yourself (like doing a CURL request to yourself from an ajax call)? The reason I ask is I know that mocking objects is a problem right now with Dusk and I figured I would just create a test API URL to points to myself (routes become available only during testing) to mock the responses for an external API my APP uses. Problem is I just realized that I would end up with a deadlock of sorts since the internal PHP webserver cannot handle more than 1 request at a time. I've actually given up on trying to get Dusk to work on my dev environment. While I may have gotten Chrome to somewhat work, the actual testing part just executes too slow. This is probably related to Docker's slowness when working with shared files on a Windows host. So now, I'm just trying to run Dusk through my host machine instead and was hoping that I could just rely on PHP's internal server, instead of having to install a web server too on my host machine |
Yes. With Ajax I know you won't have problems. I have a test that clicks on a button and waits for an ajax response and then asserts for database changes.
The reason this works is because Dusk (through Facebook Web Driver) makes a HTTP request to Chrome Driver for a new Chrome Session. Once that is done we're inside the testable callback. When visiting a page, Chrome Driver will instruct the browser to load the page and once it's fully loaded, PHP Internal Server will rest (it's job is done). You cannot make an ajax call from the page until the page is fully loaded, hence you cannot deadlock it by making two calls. Chrome NEEDS to wait the page to be done so it can act and your action will be performed after the server is free to take your ajax request. Now, when making a request from your controller, you might be right because Chrome is waiting for the PHP Server to reply with the page, but PHP Server would be waiting itself to reply an internal request, leading to deadlock. |
So I guess there is no sane way to fake responses for server code that interfaces with an external API through the internal PHP web server, other than running things through an actual web server? Would have been nice if mocking were possible, since then I would have just simply created an object that returned fixed responses instead of going through the wire. |
I have been bashing my head on mocking. My first dead end was trying to serialize a closure and then executing it from the PHP process that is invoked by Chrome. Now I'm trying with a static class and although I managed to serialize/unserialize it, calling |
That doesn't sound fun. I might just put environment checks inside my AppServiceProvider class and load mocked classes when under testing. I'm closing this issue since I sort of found the answer to the cause of my main issue in the first place (getting chrome to run) |
I've been trying to get dusk to work on my Docker setup which uses Centos 6.8 but seem to run into different issues. Unless I understand this wrong, I need Chrome installed to get chromedriver to work correct? Well I did just that (using https://chrome.richardlloyd.org.uk/ since newer versions Google Chrome do not support RHEL 6 anymore) and after trying to run the chromedriver-linux bin, I am met with library issues ('GLIBCXX_3.4.15' not found, 'CXXABI_1.3.5' not found, 'GLIBCXX_3.4.14' not found). I then read that I could get chromedriver to use the libraries from the chrome install I just performed (
export LD_LIBRARY_PATH=/opt/google/chrome/lib
). This does seem to make it work nowUnfortunately, trying to run
./artisan dusk -vvv
gives me the followingand it stays there for a while before crashing with an error stating that the operation timed out. Is there anything else I'm missing to get this working?
The text was updated successfully, but these errors were encountered: