Stylesheets not applied in Chrome - google-chrome

Using Watir with Chromedriver. When running tests (not headless), my stylesheets are not applied. When running chrome normally (not testing) my stylesheets show up.
What's the deal? This didn't happen yesterday.
Specs:
Ubuntu 16.04 LTS
Chrome Version 59.0.3071.104 (Official Build) (64-bit)
ChromeDriver 2.30.477691 (6ee44a7247c639c0703f291d320bdf05c1531b57)
watir 6.2.1
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]

I assume that you are accessing the application-under-test via embedded credentials. Chrome v59 removes support for embedded credentials in subresource requests. Here's what the documentation says:
Drop support for embedded credentials in subresource requests. (removed)
We should block requests for subresources that contain embedded
credentials (e.g. "http://ima_user:hunter2#example.com/yay.tiff").
Such resources would be handled as network errors

Related

Applications not rendering while using selenium webdriver

I'm working on functional testing. I'm using selenium, protractor and cucumber with Typescript. I'm generally testing on Chrome.
Recently, I've got a problem with my Chrome webdriver (See the image below).
Rendering problem on Chromedriver
As you can see, it seems to be a rendering problem. The problem occurs only when I'm running chrome with selenium webdriver and it triggers with all of my applications.
Environment :
MacOS High Sierra
Protractor 5.3.2
Webdriver-manager 12.0.6
ChromeDriver 2.40
Moreover, my colleague who has the same environment and the same projects work perfectly on his machine.
I tried some tricks :
uninstall and install Google Chrome
downgrade chrome version
downgrade chrome driver version
Restart my machine and my environment
Clean the Chrome webdriver cache
Delete and redownload Node modules
Pull an ancient version of each project
Downgrading and upgrading Protractor
The rendering is working perfectly on Firefox, so the problem is on Chrome only.
By the way, all the page components are in the DOM, it is just about a display problem.
Is anyone got any idea ?

Why doesn't ChromeDriver require Chrome or Chromium?

ChromeDriver is working on my system even though I don't have Chrome or Chromium installed. Based on the name, I thought it was like a "car driver" where you still need a car to get going. Or maybe like a product's API where you still need the product for your API calls to accomplish something.
Edit: Whoops, Chromium is installed after all.
Of course ChromeDriver requires Chrome or Chromium.
As per ChromeDriver - WebDriver for Chrome ChromeDriver is a separate executable that WebDriver uses to control Chrome.
Now, as per Requirements - ChromeDriver the server expects you to have Chrome installed in the default location for each system as follows:
1For Linux systems, the ChromeDriver expects /usr/bin/google-chrome to be a symlink to the actual Chrome binary.
You can also force ChromeDriver to use a custom location by setting a special capability. You can find the documentation in Using a Chrome executable in a non-standard location

Get URL of currently active chromium or chrome tab from external process

How can I get the current chromium tab URL from an external process in linux programmatically?
There are many similar questions to this one, but I haven't found any with the following requirements
Solution should work from outside of the chrome process, i.e. not within javascript or a chrome extension.
Solution should not be based on autohotkey, xdotool, wmctrl or similar tools for simulating keyboard or mouse input
No OSX or Windows-specific solutions
In firefox, there is mozrepl, which exposes browser internals through an interactive repl over a TCP port. I am looking for something similar in chromium or chrome, even if it means installing a chrome extension.
I implemented #Asesh suggestion in https://github.com/erjoalgo/chrome-current-url, it is a chrome extension that exposes the currently active tab's URL through a local http server.
pip install chromeurl
sudo chromeurl --install-manifest native
Then install the extension from the webstore
Finally, query the current chrome url:
$ curl http://localhost:19615/tabs/current/url
https://developer.chrome.com/extensions/activeTab

Chrome Headless Doesn't work

I've read about the Chrome Headless from developers.google said we can run the Google without UI. Quote from that link :
Headless Chrome is shipping in Chrome 59. It's a way to run the Chrome
browser in a headless environment. Essentially, running Chrome without
chrome! It brings all modern web platform features provided by
Chromium and the Blink rendering engine to the command line.
Why is that useful?
A headless browser is a great tool for automated testing and server
environments where you don't need a visible UI shell. For example, you
may want to run some tests against a real web page, create a PDF of
it, or just inspect how the browser renders an URL.
This is really great feature, so I do some experiment with this cool feature. The idea is to taking snapshot as the document site by do call of chrome.exe from Windows Command Prompt, as follow :
chrome --headless --disable-gpu --screenshot https://www.chromestatus.com/
After do several times and following the instruction from these site. I got nothing. I don't get any picture or screenshot with name screenshot.png as document mention it before Running with --screenshot will produce a file named screenshot.png in the current working directory.
From this document also said about version,
Caution: Headless mode is available on Mac and Linux in Chrome 59.
Windows support is coming in Chrome 60. To check what version of
Chrome you have, open chrome://version.
after do some check with suggested before, I run chrome://version on my Chrome on Windows x64 Machine and got some result :
Google Chrome 62.0.3202.94 (Official Build) (64-bit) (cohort: Stable)
Revision 4fd852a98d66564c88736c017b0a0b0478e885ad-refs/branch-heads/3202#{#789}
What wrong? What i missed?
Thanks
After do some experiments. for --screenshot will save the image on the same level as chrome.exe location and that will be mean save on Program Files.
So we need need to combine parameter names and arguments with a =
--screenshot="D:\screen.png" will work, otherwise Chrome writes to it's installation folder. Big design flaw, no software should use it's installation folder as a working directory.
Here are the complete argument :
chrome --headless --enable-logging --disable-gpu --screenshot="D:\screen.png" "https://www.chromestatus.com/"

How to add the chrome binary to run e.g. Karma tests on headless chrome on a CI server

I like to run my karma unit tests on a headless chrome. Using karma-chrome-launcher and setting the browser to "ChromeHeadless" works on my machine. But on the CI server it fails with the message "No binary for ChromeHeadless browser on your platform."
Installing chrome on the CI machine is not possible. Is there another way to load the chrome binaries?
for example the google puppeteer module seems to load that when run. from the docs: "Puppeteer downloads and uses a specific version of Chromium". How can i achieve the same?
You can use Puppeteer (headless Chromium), follow these instructions.
If what you fear is that download from the internet might be slow, you can tell puppeteer where to download chrome from and use a local address.
Use PUPPETEER_DOWNLOAD_HOST to specify where to download Chrome from and PUPPETEER_SKIP_CHROMIUM_DOWNLOAD to skip downloading Chrome altogether.
You can read more about this in the documentation.