Here's my messages received via WebSocket. When I send this message:
{ id: 3, method: 'Network.enable' }
... it replies with:
{ id: 3, error: { code: -32601, message: "'Network.enable' wasn't found" } }
It says the same for 'Page.navigate' as well.
{"method":"Target.targetCreated","params":{"targetInfo":{"targetId":"1541d58d-c591-4a88-9e53-852b43ad9151","type":"browser","title":"","url":"","attached":true,"canAccessOpener":false}}}
{"method":"Target.targetCreated","params":{"targetInfo":{"targetId":"53D6E4E3FF62F8365364C9C252B99EA1","type":"background_page","title":"Chrome Media Router","url":"chrome-extension://pkedcjkdefgpdelpbcmbmeomcjbeemfm/_generated_background_page.html","attached":false,"canAccessOpener":false,"browserContextId":"FA3F0A2AA7B4498D28B9CD859D95FBB4"}}}
{"method":"Target.targetCreated","params":{"targetInfo":{"targetId":"885AA252B844C7B4FEC9F5AA2174CC76","type":"page","title":"","url":"https://www.websocket.org/echo.html","attached":false,"canAccessOpener":false,"browserContextId":"FA3F0A2AA7B4498D28B9CD859D95FBB4"}}}
{"id":1,"result":{}}
{"method":"Target.targetInfoChanged","params":{"targetInfo":{"targetId":"53D6E4E3FF62F8365364C9C252B99EA1","type":"background_page","title":"Chrome Media Router","url":"chrome-extension://pkedcjkdefgpdelpbcmbmeomcjbeemfm/_generated_background_page.html","attached":false,"canAccessOpener":false,"browserContextId":"FA3F0A2AA7B4498D28B9CD859D95FBB4"}}}
{"method":"Target.targetInfoChanged","params":{"targetInfo":{"targetId":"885AA252B844C7B4FEC9F5AA2174CC76","type":"page","title":"","url":"https://www.websocket.org/echo.html","attached":true,"canAccessOpener":false,"browserContextId":"FA3F0A2AA7B4498D28B9CD859D95FBB4"}}}
{"method":"Target.attachedToTarget","params":{"sessionId":"F9B5F64C1027EDFD4C1C20B827D40CF0","targetInfo":{"targetId":"885AA252B844C7B4FEC9F5AA2174CC76","type":"page","title":"","url":"https://www.websocket.org/echo.html","attached":true,"canAccessOpener":false,"browserContextId":"FA3F0A2AA7B4498D28B9CD859D95FBB4"},"waitingForDebugger":false}}
{"id":2,"result":{"sessionId":"F9B5F64C1027EDFD4C1C20B827D40CF0"}}
{"method":"Target.targetInfoChanged","params":{"targetInfo":{"targetId":"885AA252B844C7B4FEC9F5AA2174CC76","type":"page","title":"https://www.websocket.org/echo.html","url":"https://www.websocket.org/echo.html","attached":true,"canAccessOpener":false,"browserContextId":"FA3F0A2AA7B4498D28B9CD859D95FBB4"}}}
{"id":3,"error":{"code":-32601,"message":"'Network.enable' wasn't found"}}
You need to create the session first, if you are using java / selenium the code is: devTools.createSession();
before activate that , you need to create session in the devTools
you can activate with this way
DevTools chromeDevTools = chromeDriver.getDevTools();
chromeDevTools.createSession();
And after that you can do whatever you want
thank's
Related
I got a React-Native application working with a NodeJS backend which serves an API.
My React-Native front is using Expo and Axios to hit on a route of my NodeJS API (using Hapi, Joi, Knex), which will (for the example) update my DB (MySQL).
Everything works properly with my iOS simulator. However, on Android Emulator, SOME of my hits on route ""does not work"" with the following error message : Network Error - node_modules/axios/lib/core/createError.js:16:24 in createError (actually, it worked, but the front does not detect it...)
This is strange, because like I said, this is ONLY for some of my route. I changed the http://localhost:8000/api to http://10.0.2.2:8000/api to be sure that Android Emulator access my API, and it is ok for this part.
The buggy route is working properly on iOS, and is working properly on Insomnia / Postman ( localhost:8000/api/sendMail ). It is working on Android Emulator, but the application does not detect it.
This is an example of my code :
FRONT -- On press of my button "SendEmail" :
/* Button.js */
const sendAndEmailPromise = await sendEmail(this.state.email);
console.log(sendAndEmailPromise); // Output : NOTHING (not undefined, not null, N O T H I N G).
if (sendAndEmailPromise.status === 200) {
// handle it
} else (sendAndEmailPromise.status === 403) {
// etc. for each of my codeStatus that can be returned by my API
}
/* MyAPI.js */
export function sendEmail(mail) {
return axiosInstance
.post(`/sendEmail`, null, {
params: {
mail
},
})
.then(response => response) // Will not enter here
.catch(error => {
console.log(error); // Will output : NETWORK ERROR
});
}
BACK -- This is the sendEmail promise :
// Will return true of false :
const isMailSend = await sendTheEmail(mail);
console.log(isMailSend); // Output : TRUE and I receive the email on my gmail, so Android Emulator HIT the route.
if (isMailSend) {
return handler
.response({
data: {
message: "Email sent.",
},
})
.code(200);
} else {
// Handle it and return another response
}
I expect my front to now that everything works fine (which actually happened...) and get the code status of that, instead of a "Network error".
More, is it possible with Axios to get another level of error ? Something more specific.
A GitHub issue which is not totally the same but seems to relate something equivalent : https://github.com/axios/axios/issues/973
Thank you.
You are dealing with two problems here:
1) your emulator doesnt work because it cannot resolve the word "localhost" to an ip. is like using localhost2.com it will not resolve to something. This must be pointed to the local ip of your server 192.x.x.x
2) you server must be binded to 0.0.0.0 because by binding it to localhost it cannot resolve to local requests like 192.x.x.x. If you fix the binding your emulator would have the possibility to see the server and postman will too.
Adding these parameter in header resolved my issue
"Content-Type": "application/x-www-form-urlencoded",
Accept: "application/json"
I m trying to use back4app for push notification. For this I have installed back4app's ionic sdk (https://www.back4app.com/docs/ionic/parse-ionic-sdk) like this
npm install parse
then in my app.component.ts I imported parse
import Parse from 'parse';
and in platform ready
Parse.serverURL = "https://parseapi.back4app.com/";
Parse.initialize("APP_ID_HERE", "JAVASCRIPT_KEY"); //I have used real keys from back4app dashboard.
let install = new Parse.Installation();
install.save(null, {
success: (install) => {
// Execute any logic that should take place after the object is saved.
// console.clear();
console.error('New object created with objectId: ' + install.id);
},
error: (install, error) => {
// Execute any logic that should take place if the save fails.
// error is a Parse.Error with an error code and message.
//console.clear();
console.error('Failed to create new object, with error code:' + error.message.toString());
}
});
When I do Ionic serve or test it in device, it should register device/installation id to their backend but it gives 400 Bad Request error on https://parseapi.back4app.com/classes/_Installation the error was -
{"code":135,"error":"deviceType must be specified in this operation"}
I m not sure where to mention deviceType as their documentation doesn't seem that good.
Can anybody help me on this??
This is not mentioned in their documentation but I have found it in one of their example.
Replacing -
let install = new Parse.Installation();
with
let install = new Parse.Installation();
install.set("deviceType", platform.platforms().toString());
Solved the issue.
Here is the link to their repository
Parse SDK now supports Promises.
I'd recommend using it instead of passing in callbacks.
You can accomplish that by:
install.save().then(() => {
// success
}, err => {
// error
})
I am using groovy wslite plugin to make a soap call. I am getting wslite.http.HTTPClientException: 404 Not Found. Can someone help me to debug the issue.
Groovy code
def client = new SOAPClient(Helper.getConfigValue('grails.soap.ws.url'))
try {
def response = client.send(SOAPAction: SOAP_NAMESPACE + SOAP_ACTION_START_PROCESS,
sslTrustAllCerts: true) {
header {
delegate.securityInfo(buildSecurityInfoObject())
}
body {
getNotificationRequest('xmlns': SOAP_NAMESPACE) {
delegate.transactionId('12345')
}
}
}
You probably did this alredy, here I ask anyway: Have you verified that the resource exists under the path/url you are trying to retrieve it from?
404 often indicate that the host is not available.
I am trying to make a Google Calendar push notification API call (https://developers.google.com/google-apps/calendar/v3/push). I figured out how to make a calendar list call. So, I am fairly confident that my Oauth 2.0 authentication piece is working. I am guessing that I need to specify that the push notification call is a POST. Here are my codes:
var params = { calendarId: calendarId,
id: 'my-unique-id-00001',
type: "web_hook",
address: "https://mydomain.com/notifications" };
client
.calendar.events.watch(params)
.withAuthClient(authClient)
.execute(callback);
I keep getting this error message:
{ errors:
[ { domain: 'global',
reason: 'required',
message: 'entity.resource',
debugInfo: 'com.google.api.server.core.Fault: ImmutableErrorDefinition{base=REQUIRED, category=USER_ERROR, cause=com.google.api.server.core.Fault: Builder{base=REQUIRED, ...
While I was attempting to watch something using the Google Drive API, I ran into the same issue. The issue turned out to be that some of the parameters need to be in the response body.
In your case I believe that the calendarId needs to be a path parameter and the others need to be in the request body. Something like this should work
var pathParams = { calendarId: calendarId };
var bodyParams = {
id: 'my-unique-id-00001',
type: 'web_hook',
address: 'https://mydomain.com/notfications'
};
client
.calendar.events.watch(pathParams, bodyParams)
.withAuthClient(authClient)
.execute(callback);
I started using Restangular to send RESTful requests from my AngularJS app. I have a REST service deployed on http://localhost:20080/v1/customer which produces JSON with customer information.
When I debug AngularJS app it hits a breakpoint in the back-end REST service, however in the browser console it always logs "Failed to find customers with status code 0". Moreover, I never hit the breakpoint in the function that I register as setResponseExtractor.
I also don't see any errors in the console.
When I open http://localhost:20080/v1/customer in the browser I get the following response:
[{"customerInfo":{"name":"My Name","email":"My Email"},"id":"6ca43d0f-94a8-36e8-af3d-963584573d6d"}]
My Restangular code is as follows:
var customerModule = angular.module('customer-module',
['restangular' ]).config(
['RestangularProvider', '$httpProvider',
function (RestangularProvider, $httpProvider)
{
RestangularProvider.setBaseUrl('http://localhost\\:20080/v1');
RestangularProvider.setResponseExtractor(function (response, operation, what) {
return response;
});
...
customerModule.controller('CustomerCtrl',
[ '$scope', 'Restangular', function ($scope, Restangular)
{
var baseCustomers = Restangular.all("customer");
$scope.customers = baseCustomers.getList().then(function (result) {
console.log("Got customers", response.status);
}, function (response) {
console.log("Failed to find customers with status code", response.status);
});
Thoughts?
I'm the creator of Restangular.
You also don't have to add the responseExtractor to the config if you're just returning the response. That's what it does by default.
If you have any other problem, please contact me!
The problem turned out to be with accessing REST services running on a different port than my AngularJS app.
I am moving this thread to AngularJS mailing list - "Problems with a basic $resource.get() call"
Alec