Phantomjs caching issue - selenium

I'm following This to get a website's dynamic content inside an MVC application.
I've received the data once or twice, but after that I'm getting an error -
ApplicationCache driver.ApplicationCache threw an exception of type
'System.InvalidOperationException' OpenQA.Selenium.Html5.IApplicationCache {System.InvalidOperationException}
Message:
Driver does not support manipulating the HTML5 application cache. Use the HasApplicationCache property to test for the driver capability

The error that you're encountering is due to the fact that PhantomJS can't find anything in the appCache and hence throws this exception. Please see the underlying code here, which states
public IApplicationCache ApplicationCache
{
get
{
if (this.appCache == null)
{
throw new InvalidOperationException("Driver does not support manipulating the HTML5 application cache. Use the HasApplicationCache property to test for the driver capability");
}
return this.appCache;
}
}
And the reason, why this is coming to be null is that currently PhantomJS doesn't supports this app caching. The default capabilities for this is set to false in the PhantomJS code . You can see this here, which mentions
_defaultCapabilities{
"applicationCacheEnabled" : false,
}

Related

.Net 6 Blazor Not Able to Get Detailed Error Message

I have a .Net 6 Blazor server side app.
The app has an error
Error: There was an unhandled exception on the current circuit, so this circuit will be terminated. For more details turn on detailed exceptions by setting 'DetailedErrors: true' in 'appSettings.Development.json' or set 'CircuitOptions.DetailedErrors'.
I have tried setting the CircuitOptions.DetailedErrors = true.
I have ensured I am in Debug mode, i.e. the Environment.IsDevelopment switch is set to true.
Program.cs
if (builder.Environment.IsDevelopment())
{
builder.Services.AddServerSideBlazor().AddCircuitOptions(x => x.DetailedErrors = true);
}
else
{
builder.Services.AddServerSideBlazor();
}
and I have set 'DetailedErrors: true'in appSettings.Developmnet.json and appSettings.json.
"AppSettings": {
"DetailedErrors": true,
However this has not affected the error message in anyway.
I am still am unable to get the detailed error message.
Any ideas on what else to try?
Please make that the appsettings.production.json file is populating with the same flags in the publishing folder path. This happens normally when appsettings.json is different from appsettings.{Environment}.json file.

CakePHP in plugin can't Load model

Im using plugin, I want just to load data from my table as json, the problem is in local it's working and in the server I found this error in log :
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster#localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
my model:
<?php
class Indisponibilite extends AppModel {
var $name = 'Indisponibilite';
}
my function:
public function getIndisponible () {
$indisponibles = ClassRegistry::init('Indisponibilite')->find('all');
echo json_encode($indisponibles);
$this->layout = 'ajax';
$this->autoRender = false;
$this->render(false, "ajax");
error_reporting(0);
}
First of all: Please check the docs about JSON Views which are much more MVC and Cake-ish. For Cake 2.x check here.
Also, don’t set error_reporting. CakePHP should handle all this for you. Setting Configure::write('debug', 0) will turn off error_reporting for you.
To find your error, check the logs, turn on debug and see what’s up there.

Uncaught TypeError: Cannot use 'in' operator to search for 'SUPPORT_COOKIES' in null

I am using IBM Worklight Developer Edition 5.0.5 to try to create simple(HTML and Adapter) application, but facing unresolved problem.
This could be a same problem which is not answered in old forum:
http://www.ibm.com/developerworks/forums/thread.jspa?threadID=460738
[Environment]
OS: Windows7 64bit(Japanese locale),
Eclipse: 4.2.1,
Worklight: Developer Edition 5.0.5
[Description]
I created Worklight Project in my Eclipse, without any external libraries like jQuery mobile nor Dojo. I added HTTP Adapters and SQL Adapters into this Project. Both seems to work fine when I try 'Run As .. -> Invoke Worklight Procedure'. Both returned expected JSON. So I don't think there would be a problem in Adapters.
But when I call those adapters from HTML file, I got "Uncaught TypeError: Cannot use 'in' operator to search for 'SUPPORT_COOKIES' in null" error in worklight.js(line:2380).
[My code]
var invocationData = { adapter : 'SQLAdapter', procedure :
'getCount', parameters : [] };
WL.Logger.debug( "1: invocationData = " + invocationData );
WL.Client.invokeProcedure( invocationData, { onSuccess:
loadFeedsSuccess, onFailure: loadFeedsFailure });
WL.Logger.debug( "2: loadFeeds" );
function loadFeedsSuccess( result ){ WL.Logger.debug( "3: success:
result = " + result ); }
function loadFeedsFailure( result ){ WL.Logger.debug( "4: failure:
result = " + result ); }
[My debug console output]
1: invocationData = [object Object] worklight.js:1112
Uncaught TypeError: Cannot use 'in' operator to search for
'SUPPORT_COOKIES' in null worklight.js:2380
wlclient init started worklight.js:1112
before: app init onSuccess worklight.js:1112
after: app init onSuccess worklight.js:1112
wlclient init success
So it seems only first WL.Logger.debug() is called successfully, but WL.Client.invokeProcedure() seems to cause above Uncaught TypeError, and it just failed(not call success-case callback, nor failure-case callback).
This is a SQL Adapter case, but when I tryed to use HTTP Adapter, the result was same(failed in WL.Client.invokeProcedure()). Again, both returns appropriate result when I try 'Run As .. -> Invoke Worklight Procedure'.
My console says this failure happens in line 2380 of worklight.js:
2379: isEnabled : function(field) {
2380: return !!(field in profile && profile[field]);
2381: }
So I have no idea what would be wrong with my code. Are there any idea/information for this problem? Thanks for advance.
Added
Same error was happened in Mac OSX environment too.
I have found what caused my problem.
When accessing adapter, I edited my javascript inside of HTML file directly, using <script> tag at very bottom of autogenerated <script> tags, and tried to create initial page. I believe that is not appropriate way for Worklight. I am not sure what was wrong exactly, but my javascript code could be loaded before everything prepared.
Now I changed my code. I moved my javascript, which used to be inside of HTML, to very bottom of wlCommonInit() function in (Projectname).js. Currently it seems to work fine with no error message like before, and retrieves expected information via adapter. This might be an appropriate way.
Calls to Worklight APIs like
WL.Client.invokeProcedure and WL.Logger.debug should take place only after wlCommonInit is called.
wlCommonInit resides in your application's main JavaScript file (your-project\your-application\js\application-name.js).
To resolve such kind of issue, we need to check when we are invoking the first adapter call. We need to delay the adapter call for some more seconds like 1000ms. Then your application will run as you like it.
setTimeout(function(){
$(document).ready(function() {
var invocationData = {
adapter : 'Contract',
procedure : 'GetDropDownListForLogin'
};
console.log("Invocation data:" +invocationData);
var options = {
onSuccess : OnLogindataSucess,
onFailure : OnLoginFail,
};
WL.Client.invokeProcedure(invocationData,options);
});
},1000);
Please use the following way for the first adapter to call it will resolve your issue.

Determine if internet connection is available

how do you folks check if the device is connected to the internet in a sencha touch app?
There's an attribute called navigator.onLine (general browser support, not specific for Sencha)
If I'm in a PhoneGap application (which you often are if you're using Sencha Touch), I'd rather use their network.isReachable function, since I've by experience found it more reliable.
There's also something called 'Offline events', John Resig describes them on his blog: http://ejohn.org/blog/offline-events/.
If there is no network connection during an ajax request sencha touch will return a response with a 0 status. So this is what we're using in our app (works in phonegap too):
// global error handling
Ext.Ajax.on('requestexception', function(connection, response) {
// get rid of any loading masks that are present
Ext.each(Ext.query('.x-mask'), function(el) {
new Ext.Element(el).hide()
});
switch(response.status) {
case 0 :
Ext.Msg.alert('Error Loading', 'No Internet connection.');
break;
case 401 :
Ext.Msg.alert('Login Failed', 'Check your username and password.');
break;
default :
Ext.Msg.alert('Whoops!', 'An unexpected error has occurred and we have been alerted.');
}
});
Note that this is for touch 1.1, haven't tried in in 2.0 yet.

Entity Framework objectcontext ending prematurely

Hello I am getting the error "ObjectContext instance has been disposed and can no longer be used for operations that require a connection". When I run some methods from a wcf service. All of them use a new context object and most of them run without issue. However this one keeps giving the error above although several methods with similar implementations succeed several lines above in my code:
public CustomAuthentication.WebService.Application GetApplicationByUrl(string url)
{
try
{
using (AuthenticationEntities2 auth = new AuthenticationEntities2())
{
Application app = auth.Applications.Where(a => a.Url.Contains(url)).FirstOrDefault();
return app;
}
}
catch (Exception ex)
{
throw new FaultException(ex.Message + "\r\n" + ex.StackTrace + "\r\n" + ex.InnerException);
}
}
I also initially saw this error from vs "The underlying connection was closed: A connection that was expected to be kept alive was closed by the server." So I thought it was an issue serializing objects in my wcf service. So I did some tracing on the service and discovered the error above. So now believe its entity related. Any ideas?
Try to turn off lazy loading on your ObjectContext. Most probably your Application contains navigation properties which trigger lazy loading during serialization.