I've got a chrome app with several isolated layers (webviews, iframes), all those layers are logging some debugging stuff to console with console.log().
I managed to get all console logs inside a chrome debug log when launching chrome on mac os with --enable-logging --v=1 flags.
The problem is I can't get all the console.logs when running the app in chrome os. For chrome os debugging I wrote the following into /etc/chrome_dev.conf file:
CHROME_LOG_FILE=/tmp/chrome_debug.log
--enable-logging --v=1
So I expect pretty much the same logs as I get when running chrome app on mac os, but I do not see any console.logs in /tmp/chrome_debug.log.
Would appreciate any advice how to get my app console.logs in chrome debug log on chrome os
Please read the comments in the /etc/chrome_dev.conf file, particularly this one at the top:
# This file may be modified to make local changes to the environment and command
# line that session_manager uses to run Chrome. It contains one directive per
# line, with the following forms available:
That means your --enable-logging --v=1 is incorrect because you put two options on one line instead of one option per line.
Related
I was setting up chromedriver with selenium, using the test script provided on the chromdriver website. Everything worked fine, until I switched to a different WiFi network. Now I'm getting an error message when running my script.
I have searched the web for solutions, and I've tried the following things:
Made sure the chromedriver version matches my chrome version.
Try to whitelist the ip-address
I checked for 127.0.0.1 localhost in /etc/hosts
The test code I'm running (/path/to/my/chromedriver is correct):
import time
from selenium import webdriver
driver = webdriver.Chrome("/path/to/my/chromedriver") # Optional argument, if not specified will search path.
driver.get('http://www.google.com/xhtml');
time.sleep(5) # Let the user actually see something!
search_box = driver.find_element_by_name('q')
search_box.send_keys('ChromeDriver')
search_box.submit()
time.sleep(5) # Let the user actually see something!
driver.quit()
I'm expecting the program to run fine, and the browser should pop up. However, the browser is not popping up and I'm getting the following error message:
File "test.py", line 4, in
driver = webdriver.Chrome("/path/to/my/chromedriver") # Optional argument, if not specified will search path.
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in init
self.service.start()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/selenium/webdriver/common/service.py", line 104, in start
raise WebDriverException("Can not connect to the Service %s" % self.path)
selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /path/to/my/chromedriver
When running the chromedriver in the terminal I'm getting the following message (and the browser is also not popping up as supposed to):
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
EDIT: I have the same problem with the geckodriver for firefox, so it is not specific for Chrome.
I have a Selenium automation script which was working fine with Chrome v.58, but after the upgrade, my test cases keeps on failing randomly due to the issue chrome not reachable.
I have checked the chromedriver log file and found out the request to init is failing. Can someone please help me out to solve this.
[1.961][INFO]: Launching chrome: "C:\Program Files
(x86)\Google\Chrome\Application\chrome.exe"
--disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-infobars --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --enable-precise-memory-info --ignore-certificate-errors --js-flags=--expose-gc --load-component-extension="C:\Users\prateek.rajendra\AppData\Local\Temp\Mxt94\tmp\scoped_dir10588_12332\internal"
--log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12666 --safebrowsing-disable-auto-update --start-maximized --test-type --use-mock-keychain --user-data-dir="C:\Users\prateek.rajendra\AppData\Local\Temp\Mxt94\tmp\scoped_dir10588_26250"
data: [58.967][DEBUG]: DevTools request failed [59.028][DEBUG]:
DevTools request: http://localhost:12666/json/version
This is a common got you in the Selenium world. You need to update your chromedriver also and your issue will get fixed.
If I understand correctly currently you have updated the chrome browser but have not update chromedirver. Just go to Selenium website and download the latest driver and your issue will vaporise.
Best,
OK, so I have been searching a lot to get proper solution to the blocker I am facing right now. Let me give you a background of what I have done so far :
I want to run protractor tests (located on Linux machine) on IE 11 of Windows Server 2012 R2 (IP : 10.81.73.248). My protractorTest.conf.js has below :
exports.config = {
seleniumAddress: 'http://10.81.73.248:4444/wd/hub',
baseURL: 'http://10.81.78.137:80000/',
capabilities: {
browserName: 'internet explorer',
platform: 'ANY',
version: '11'
},
On my Windows Server 2012 R2 machine, I've downloaded IEDriverServer_Win32_2.47.0 and placed it under C:\Windows\System32, environment variable PATH has been updated with above location. Protected mode settings are same for all zones. Windows machine also has selenium-server-standalone-2.48.2.jar placed under C:\Users\Selenium.
On Windows machine, I am starting selenium server using below command :
java -jar selenium-server-standalone-2.48.2.jar -port 4444 -Dwebdriver.ie.driver="C:\Windows\System32\IEDriverServer_Win32_2.47.0\IEDriverServer.exe" , which starts selenium server fine.
With above settings, I run protractor tests from my Linux machine using grunt protractor_test, which launches IE browser on Windows machine, shows localhost:dynamic port and a message as : This is the initial page of webdriver server and within 2 seconds, closes the browser.
The exception I get on selenium server terminal is as below :
Session ID is null. Using WebDriver after calling quit() ?
This is where I am stuck at. I looked at various posts which describes similar issue (?) as mine along with the potential solution, but I am unable to resolve my issue here.
Is there anything I might be doing wrong to setup the connections ? or am I missing some steps to get me through ?
I would really appreciate if you guide me in resolving this long time pending blocker.
I think you are trying to run using old selenium version.It should be 2.53.x something.
Few basics things to check first regarding IE execution:
1).IE Setting for protractor(Selenium)
http://elgalu.github.io/2014/run-protractor-against-internet-explorer-vm/
2).Take IE driver of 32 bit(don't take 64 it has known slowness issues) and manually copy on the following path:
Root Folder\node_modules\protractor\node_modules\webdriver-manager\selenium\IEDriverServer_Win32_2.53.1
3). IE Driver can be downloaded from following path:
http://selenium-release.storage.googleapis.com/index.html?path=2.53/
**OR**
Please upgrade your protractor version to latest like 4.0.11 by changing the version in package.json file and do from command prompt(inside project root directory):
npm update
and then give update your selenium driver with following command from command prompt
webdriver-manager update --ie
it will update the selenium version of IE driver to latest and then try running your tests again.
I have accidentally delete source code of nodejs application, but this application is running, so how can I get source code back from running app?
I hope source code has been cached in some directory.
I was able to recover the full file by attaching the debugger (as TGrif suggested).
To actually recover the code:
Use setBreakpoint('app.js', 10), where 10 is a line of the code you know will be ran over again in the running process
Say pause, then next until it's paused on the script you want to recover.
Finally, say list(5000), where 5000 is an arbitrarily long number of lines to list.
You will now have your full script printed out, albeit with line numbers at the front, but you can use a site like this to remove them.
Hope this helps anyone who encounters this unique issue in the future, as this took me a couple hours to figure out.
There is maybe a way to retrieve some of your source code with the Nodejs debugger.
Assuming Linux OS, you need to get the process id of your application:
$ ps -e | grep node
Next you entering your app in debug mode with something like that:
$ kill -s USR1 PID
where PID is the pid of your node app.
Then your start the debug console:
$ node debug -p PID
If you have an app console, you'll see:
Starting debugger agent.
Debugger listening on port 5858
In your debug console you should see a debug prompt and you can get available commands with:
debug> help
I am able to show some of the running app source with the list command:
debug> list(NUMBER_OF_LINE)
where NUMBER_OF_LINE is the number of source code line you want to display.
I'm not sure this is a one shot try for you or not because my source code was not deleted.
Hope you can get some results.
Following this question, how do I launch instruments with iPhone simulator as a device.
I tried this:
$ instruments -t /Developer/Platforms/iPhoneOS.platform/Developer/Library/Instruments/PlugIns/AutomationInstrument.bundle/Contents/Resources/Automation.tracetemplate -w iphonesimulator5.0 MyApp.app
But I get this error:
Instruments Usage Error : Device failed to become ready for use.
-w <deviceID> is used only when you wish to specify a hardware device as the destination (the 'deviceID' here is the Identifier of the device, found in the Organizer of Xcode).
Instead of using -w, you can specify a flag during the build to force instruments to use iPhone. Details can be found here.
I was doing it as follows:
1.I created a template in which I was calling my UI Automation Main file that Triggers running all the scripts.
EX:
//Main.js file will run auto.js scripts
//auto.js is my main file in which I am running all the scripts
//Main.js file
#import "auto.js"
auto.run();
//Now open terminal and run the following command.
1. Go to the directory where you saved your template
2.Copy the location where you simulator (full path) is
Than run the command below:
instruments -t ./NameOfYourTemplate.tracetemplate /Users/swathyvalluri/Debug-iphonesimulator/MyApp.app
Note : Create a new file in the template and copy the contents into it what ever you want to put, otherwise it will look for Main.js file in your locally and will fail when running it on another server.
Please let me know if you need more help :)
Device id means here UDID of the device.
Also see the link below, it is very useful :
http://lemonjar.com/blog/?p=69