ericmckean / chromedriver

Automatically exported from code.google.com/p/chromedriver
0 stars 0 forks source link

Hang when launching ChromeDriver via C# #1002

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Issue Description:
Since around June 2014 I've been having this problem.  When my test creates a 
ChromeDriver object and attempts to visit a URL, no URL is visited.  Instead, 
Chrome is launched and left on a page with just "data:," in the omnibar.  
Visiting a URL has no effect.  I have seen similar issues from others that are 
intermittent or have been resolved by upgrading Chrome or ChromeDriver, but 
this problem has reproduced for me consistently for 6 months.  I have been 
using IE driver as fallback for now while awaiting a fix, but it is no longer a 
viable option.  Even latest 2.13 ChromeDriver still has this problem, and I've 
been having it since 2.9.  It is is very frustrating, because Chrome was the 
most reliable and fastest browser option to test with, but now it doesn't work 
at all.  I have tried uninstalling and re-installing Chrome as well with no 
effect.

Sometimes there is an error "Could not receive message from renderer."  Other 
times there is an error "Could not send message to renderer."

ChromeDriver version: 2.13
Chrome version: 39.0.2171.95 m

Steps to reproduce:

driver = new ChromeDriver();
driver.Navigate().GoToUrl("http://localhost:4000");
driver.FindElementByLinkText("LOGIN").Click();

Original issue reported on code.google.com by xgamecom...@gmail.com on 12 Dec 2014 at 3:03

GoogleCodeExporter commented 9 years ago
Also, I'm running on Windows 7 64-bit, but Chrome and ChromeDriver are 32-bit.

Original comment by xgamecom...@gmail.com on 12 Dec 2014 at 3:05

GoogleCodeExporter commented 9 years ago
I can not get
http://localhost:4000.
Can you provide me  complete codes so that I can reproduce the issue ?  Java, 
HTML, etc..

Original comment by andrewch...@chromium.org on 12 Dec 2014 at 8:22

GoogleCodeExporter commented 9 years ago
The following will also reproduce:

driver = new ChromeDriver();
driver.Navigate().GoToUrl("www.google.com");
driver.FindElementByLinkText("Images").Click();

The URL does not matter.  Any URL will cause this issue to reproduce for me.  
It is as though GoToUrl() is entirely ineffective.

Original comment by xgamecom...@gmail.com on 13 Dec 2014 at 12:33

GoogleCodeExporter commented 9 years ago
The following set up work well for me.  
IWebDriver driver = new ChromeDriver(@"c:\chromedriverpath");   // works
            driver.Navigate().GoToUrl("http://www.google.com");
            driver.FindElement(By.LinkText("Images")).Click();

Original comment by andrewch...@chromium.org on 16 Dec 2014 at 6:18

GoogleCodeExporter commented 9 years ago
Still not working for me, even specifying the path.

I have created a .zip file containing a project with selenium and chromedriver 
binaries included.  Just compile and run, and it reproduces for me.

I see that "Issue attachment storage quota" has been exceeded.  Is there a 
better way to deliver this .zip file for your analysis?

Original comment by xgamecom...@gmail.com on 17 Dec 2014 at 3:24

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
would  you please email direct to me?
Following is not working in my set up
driver.FindElementByLinkText("Images").Click();  
I need change to 
driver.FindElement(By.LinkText("Images")).Click();

Original comment by andrewch...@chromium.org on 17 Dec 2014 at 6:53

GoogleCodeExporter commented 9 years ago
I don't see your full e-mail address anywhere.

Original comment by xgamecom...@gmail.com on 18 Dec 2014 at 12:46

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Sent just now.

Original comment by xgamecom...@gmail.com on 18 Dec 2014 at 1:18

GoogleCodeExporter commented 9 years ago
I open the project, change the path to where my chromedriver.exe is.
it works.   make sure your chrome.exe in the same path. or you need specify the 
chrome path.

Original comment by andrewch...@chromium.org on 18 Dec 2014 at 2:19

GoogleCodeExporter commented 9 years ago
I ran with the following code:

ChromeOptions options = new ChromeOptions();
options.BinaryLocation = @"C:\Program Files 
(x86)\Google\Chrome\Application\chrome.exe";
options.AddArgument("--verbose");
options.AddArgument("--log-path=chromedriver.log");
IWebDriver driver = new ChromeDriver(@".", options);
driver.Navigate().GoToUrl("http://www.google.com");
driver.FindElement(By.LinkText("Images")).Click();

Still reproduces.  No log is being generated either.  Here is an image of what 
I am experiencing:

http://imgur.com/GIFtdmZ

Original comment by xgamecom...@gmail.com on 18 Dec 2014 at 4:02

GoogleCodeExporter commented 9 years ago
1. these codes will still  run without error,  but don't get log.
2. To get chromedriver log for C# (java can do the way you want)
    you  run
   chromedriver.exe --verbose --log-path=c:\logs\chromedriver.log
  use
          ChromeOptions options = new ChromeOptions();
            options.BinaryLocation = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe";
  IWebDriver driver = new RemoteWebDriver(new Uri("http://127.0.0.1:9515"), options.ToCapabilities()); 
          driver.Navigate().GoToUrl("http://www.google.com");
            driver.FindElement(By.LinkText("Images")).Click();

Original comment by andrewch...@chromium.org on 18 Dec 2014 at 8:09

GoogleCodeExporter commented 9 years ago
I tried running the way you described (launching chromedriver.exe separately 
and connecting via port 9515), and I still get repro.  However, using your 
instructions, I was able to get a log file generated.  Here it is:

[11.930][INFO]: COMMAND InitSession {
   "desiredCapabilities": {
      "browserName": "chrome",
      "chromeOptions": {
         "binary": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
      },
      "javascriptEnabled": true,
      "platform": "ANY",
      "version": ""
   }
}
[11.930][INFO]: Populating Preferences file: {
   "alternate_error_pages": {
      "enabled": false
   },
   "autofill": {
      "enabled": false
   },
   "browser": {
      "check_default_browser": false
   },
   "distribution": {
      "import_bookmarks": false,
      "import_history": false,
      "import_search_engine": false,
      "make_chrome_default_for_user": false,
      "show_welcome_page": false,
      "skip_first_run_ui": true
   },
   "dns_prefetching": {
      "enabled": false
   },
   "profile": {
      "content_settings": {
         "pattern_pairs": {
            "https://*,*": {
               "media-stream": {
                  "audio": "Default",
                  "video": "Default"
               }
            }
         }
      },
      "default_content_settings": {
         "geolocation": 1,
         "mouselock": 1,
         "notifications": 1,
         "popups": 1,
         "ppapi-broker": 1
      },
      "password_manager_enabled": false
   },
   "safebrowsing": {
      "enabled": false
   },
   "search": {
      "suggest_enabled": false
   },
   "translate": {
      "enabled": false
   }
}
[11.930][INFO]: Populating Local State file: {
   "background_mode": {
      "enabled": false
   },
   "ssl": {
      "rev_checking": {
         "enabled": false
      }
   }
}
[11.961][INFO]: Launching chrome: "C:\Program Files 
(x86)\Google\Chrome\Application\chrome.exe" --disable-background-networking 
--disable-client-side-phishing-detection --disable-component-update 
--disable-default-apps --disable-hang-monitor --disable-prompt-on-repost 
--disable-sync --disable-web-resources --enable-logging 
--ignore-certificate-errors 
--load-extension="C:\Users\whawkins\AppData\Local\Temp\scoped_dir2012_3951\inter
nal" --log-level=0 --metrics-recording-only --no-first-run 
--password-store=basic --remote-debugging-port=12680 
--safebrowsing-disable-auto-update --safebrowsing-disable-download-protection 
--test-type=webdriver --use-mock-keychain 
--user-data-dir="C:\Users\whawkins\AppData\Local\Temp\scoped_dir2012_26343" 
data:,
[11.961][DEBUG]: DevTools request: http://127.0.0.1:12680/json/version
[12.320][DEBUG]: DevTools response: {

   "Browser": "Chrome/39.0.2171.95",

   "Protocol-Version": "1.1",

   "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36",

   "WebKit-Version": "537.36 (@186555)"

}

[12.320][DEBUG]: DevTools request: http://127.0.0.1:12680/json
[12.336][DEBUG]: DevTools response: [ {

   "description": "",

   "devtoolsFrontendUrl": "/devtools/devtools.html?ws=127.0.0.1:12680/devtools/page/37DD815E-416B-4278-B871-EEE092A5C91B",

   "faviconUrl": "chrome://extension-icon/aapnijgdinlhnhlmodcfapnahmbfebeb/24/1",

   "id": "37DD815E-416B-4278-B871-EEE092A5C91B",

   "title": "Chrome Automation Extension",

   "type": "background_page",

   "url": "chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html",

   "webSocketDebuggerUrl": "ws://127.0.0.1:12680/devtools/page/37DD815E-416B-4278-B871-EEE092A5C91B"

}, {

   "description": "",

   "devtoolsFrontendUrl": "/devtools/devtools.html?ws=127.0.0.1:12680/devtools/page/C3724BEB-E4D4-41E1-AB9D-34D92948E67E",

   "id": "C3724BEB-E4D4-41E1-AB9D-34D92948E67E",

   "title": "",

   "type": "page",

   "url": "data:,",

   "webSocketDebuggerUrl": "ws://127.0.0.1:12680/devtools/page/C3724BEB-E4D4-41E1-AB9D-34D92948E67E"

} ]

[12.336][DEBUG]: DevTools request: http://127.0.0.1:12680/json
[12.384][DEBUG]: DevTools response: [ {

   "description": "",

   "devtoolsFrontendUrl": "/devtools/devtools.html?ws=127.0.0.1:12680/devtools/page/37DD815E-416B-4278-B871-EEE092A5C91B",

   "faviconUrl": "chrome://extension-icon/aapnijgdinlhnhlmodcfapnahmbfebeb/24/1",

   "id": "37DD815E-416B-4278-B871-EEE092A5C91B",

   "title": "Chrome Automation Extension",

   "type": "background_page",

   "url": "chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html",

   "webSocketDebuggerUrl": "ws://127.0.0.1:12680/devtools/page/37DD815E-416B-4278-B871-EEE092A5C91B"

}, {

   "description": "",

   "devtoolsFrontendUrl": "/devtools/devtools.html?ws=127.0.0.1:12680/devtools/page/C3724BEB-E4D4-41E1-AB9D-34D92948E67E",

   "id": "C3724BEB-E4D4-41E1-AB9D-34D92948E67E",

   "title": "",

   "type": "page",

   "url": "data:,",

   "webSocketDebuggerUrl": "ws://127.0.0.1:12680/devtools/page/C3724BEB-E4D4-41E1-AB9D-34D92948E67E"

} ]

[12.386][INFO]: RESPONSE InitSession {
   "acceptSslCerts": true,
   "applicationCacheEnabled": false,
   "browserConnectionEnabled": false,
   "browserName": "chrome",
   "chrome": {
      "userDataDir": "C:\\Users\\whawkins\\AppData\\Local\\Temp\\scoped_dir2012_26343"
   },
   "cssSelectorsEnabled": true,
   "databaseEnabled": false,
   "handlesAlerts": true,
   "javascriptEnabled": true,
   "locationContextEnabled": true,
   "mobileEmulationEnabled": false,
   "nativeEvents": true,
   "platform": "Windows NT",
   "rotatable": false,
   "takesHeapSnapshot": true,
   "takesScreenshot": true,
   "version": "39.0.2171.95",
   "webStorageEnabled": true
}
[12.458][INFO]: COMMAND Navigate {
   "url": "http://www.google.com"
}
[12.475][DEBUG]: DEVTOOLS COMMAND Console.enable (id=1) {

}
[12.475][DEBUG]: DEVTOOLS COMMAND DOM.getDocument (id=2) {

}
[12.475][DEBUG]: DEVTOOLS COMMAND Runtime.enable (id=3) {

}
[12.475][DEBUG]: DEVTOOLS COMMAND Page.enable (id=4) {

}
[12.476][DEBUG]: DEVTOOLS COMMAND Page.enable (id=5) {

}
[12.476][SEVERE]: Unable to receive message from renderer
[12.476][DEBUG]: DevTools request: http://127.0.0.1:12680/json
[12.477][DEBUG]: DevTools response: [ {

   "description": "",

   "devtoolsFrontendUrl": "/devtools/devtools.html?ws=127.0.0.1:12680/devtools/page/37DD815E-416B-4278-B871-EEE092A5C91B",

   "faviconUrl": "chrome://extension-icon/aapnijgdinlhnhlmodcfapnahmbfebeb/24/1",

   "id": "37DD815E-416B-4278-B871-EEE092A5C91B",

   "title": "Chrome Automation Extension",

   "type": "background_page",

   "url": "chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html",

   "webSocketDebuggerUrl": "ws://127.0.0.1:12680/devtools/page/37DD815E-416B-4278-B871-EEE092A5C91B"

}, {

   "description": "",

   "devtoolsFrontendUrl": "/devtools/devtools.html?ws=127.0.0.1:12680/devtools/page/C3724BEB-E4D4-41E1-AB9D-34D92948E67E",

   "id": "C3724BEB-E4D4-41E1-AB9D-34D92948E67E",

   "title": "",

   "type": "page",

   "url": "data:,",

   "webSocketDebuggerUrl": "ws://127.0.0.1:12680/devtools/page/C3724BEB-E4D4-41E1-AB9D-34D92948E67E"

} ]

[12.477][INFO]: RESPONSE Navigate disconnected: Unable to receive message from 
renderer
  (Session info: chrome=39.0.2171.95)
[12.490][INFO]: COMMAND FindElement {
   "locator": "link text",
   "using": "link text",
   "value": "Images"
}
[12.491][DEBUG]: DEVTOOLS COMMAND Console.enable (id=6) {

}
[12.491][DEBUG]: DEVTOOLS COMMAND DOM.getDocument (id=7) {

}
[12.491][DEBUG]: DEVTOOLS COMMAND Runtime.enable (id=8) {

}
[12.491][DEBUG]: DEVTOOLS COMMAND Page.enable (id=9) {

}
[12.491][DEBUG]: DEVTOOLS COMMAND Page.enable (id=10) {

}
[12.491][SEVERE]: Unable to receive message from renderer
[12.491][DEBUG]: DevTools request: http://127.0.0.1:12680/json
[12.492][DEBUG]: DevTools response: [ {

   "description": "",

   "devtoolsFrontendUrl": "/devtools/devtools.html?ws=127.0.0.1:12680/devtools/page/37DD815E-416B-4278-B871-EEE092A5C91B",

   "faviconUrl": "chrome://extension-icon/aapnijgdinlhnhlmodcfapnahmbfebeb/24/1",

   "id": "37DD815E-416B-4278-B871-EEE092A5C91B",

   "title": "Chrome Automation Extension",

   "type": "background_page",

   "url": "chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html",

   "webSocketDebuggerUrl": "ws://127.0.0.1:12680/devtools/page/37DD815E-416B-4278-B871-EEE092A5C91B"

}, {

   "description": "",

   "devtoolsFrontendUrl": "/devtools/devtools.html?ws=127.0.0.1:12680/devtools/page/C3724BEB-E4D4-41E1-AB9D-34D92948E67E",

   "id": "C3724BEB-E4D4-41E1-AB9D-34D92948E67E",

   "title": "",

   "type": "page",

   "url": "data:,",

   "webSocketDebuggerUrl": "ws://127.0.0.1:12680/devtools/page/C3724BEB-E4D4-41E1-AB9D-34D92948E67E"

} ]

[12.492][INFO]: RESPONSE FindElement disconnected: Unable to receive message 
from renderer
  (Session info: chrome=39.0.2171.95)

Original comment by xgamecom...@gmail.com on 19 Dec 2014 at 12:53

GoogleCodeExporter commented 9 years ago
use command line, do

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" 
--disable-background-networking --disable-client-side-phishing-detection 
--disable-component-update --disable-default-apps --disable-hang-monitor 
--disable-prompt-on-repost --disable-sync --disable-web-resources 
--enable-logging --ignore-certificate-errors 
--load-extension="C:\Users\whawkins\AppData\Local\Temp\scoped_dir2012_3951\inter
nal" --log-level=0 --metrics-recording-only --no-first-run 
--password-store=basic --remote-debugging-port=12680 
--safebrowsing-disable-auto-update --safebrowsing-disable-download-protection 
--test-type=webdriver --use-mock-keychain 
--user-data-dir="C:\Users\whawkins\AppData\Local\Temp\scoped_dir2012_26343"

 see what you get

Original comment by andrewch...@chromium.org on 19 Dec 2014 at 2:18

GoogleCodeExporter commented 9 years ago
I get a very plain looking Chrome when run directly through command prompt:

http://imgur.com/Ei0KObt

I tried plugging in all the arguments into my test project as well.  It throws 
InvalidOperationException at the RemoteWebDriver/ChromeDriver constructor 
(tried both, same result).  The exception message is "cannot create default 
profile directory"

Original comment by xgamecom...@gmail.com on 19 Dec 2014 at 4:12

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I don't have that method available.  I did try driver.Url = 
"http://www.google.com", but still repro's.  Do you think it might be something 
misconfigured within Chrome?  The exception message seemed somewhat compelling 
to me.  I think if I could create this "default profile directory" myself, it 
may resolve the issue.

Original comment by xgamecom...@gmail.com on 19 Dec 2014 at 8:10

GoogleCodeExporter commented 9 years ago

you don't need to  create "default profile directory" yourself.  everything 
will be done automatically.  do you see 
C:\Users\whawkins\AppData\Local\Temp\scoped_dir2012_26343
if not, it is a problem.
can you assign your own --user-data-dir through chromeOption?  let's see how it 
work.

Original comment by andrewch...@chromium.org on 31 Dec 2014 at 10:52

GoogleCodeExporter commented 9 years ago
Yes, the directory does exist, and contains the Default folder as well as the 
files chrome_debug.log, chrome_shutdown_ms.txt, First Run, and Local State.  
When I don't specify the --user-data-dir, I get the data; URL.  When I specify 
it with the scoped_dir2012_26343 dir, I get the "cannot create default profile 
directory".  When I specify a blank directory in my Documents folder, I get the 
same exception message.

Original comment by xgamecom...@gmail.com on 6 Jan 2015 at 4:57

GoogleCodeExporter commented 9 years ago
can you trouble shoot one more time with following:

provide --user-data-dir through chromeOption (don't use dir under 
C:\Users\whawkins\AppData)

Original comment by andrewch...@google.com on 6 Jan 2015 at 6:24

GoogleCodeExporter commented 9 years ago
Yes, that is what I tried:

...
options.AddArgument("--user-data-dir=\"C:\\Users\\whawkins\\Documents\\ChromePro
file\"");
IWebDriver driver = new ChromeDriver(options);

Original comment by xgamecom...@gmail.com on 6 Jan 2015 at 8:47

GoogleCodeExporter commented 9 years ago
1. Do you use the same codes I provided in #13?
2. can you use other than C:\\Users - even I don't think that will cause 
problem.
3. we have the same  system - Windows 7 64-bit.  Can you provide me complete 
file you ran? to andrewcheng@chromium.org

Original comment by andrewch...@chromium.org on 6 Jan 2015 at 9:10

GoogleCodeExporter commented 9 years ago

Original comment by andrewch...@chromium.org on 6 Feb 2015 at 1:55

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 21 Feb 2015 at 12:26