There is an application which works only in IE, not with any other browsers. I am using HtmlUnit to send the request by setting the mandatory field and clicking on the submit button, which is giving me Error Message -
An internal error has occurred during processing
Though i have specified browserversion while creating the webClient object, like this
WebClient webClient = null;
BrowserVersion bv = BrowserVersion.INTERNET_EXPLORER_11;
webClient = new WebClient(bv);
Can anybody please tell me what else am i missing here ?
Please let me know if there is any other way of getting this done here using HtmlUnit.
Related
I am recording a script using truclient protocol.In my script ,i need to externally call an API which generates the Password. The password is fetched using the co-relation,which is used as an input for Login.
I am however unable to call the external API using the true client protocol.
Could anybody please suggest how to call an external API in true client protocol.
Have you tried the evaluate JavaScript step? You can post the message to the server and get the generated password during the runtime. XHR and fetch API should be supported in Chrome and Firefox, TCIE should support XHR.
Sure. Please check the detail steps:
Drag and drop an evaluate JS step from TruClient
Open the script editor
Add these code, make sure use the sync XHR to ensure the password is returned before the end step started:
var xhr = new XMLHttpRequest();
xhr.open("POST", '/server', false);
//Send the proper header information along with the request
xhr.setRequestHeader("xxx", "value");
xhr.send();
if (this.status === 200) {
// Request finished. Do processing here.
}
var password = xhr.response;
Change the login password step from plain text to JS and use
ArgsContext.password
to reference the previous received password.
If you have another questions please let me know. How to use the argument context you could reference this link.
BTW. the window and document object of the page can be referenced with AUT.window, AUT.document in TruClient.
Please check the help document from here.
I am fairly new with using Selenium in my Ruby script. Basically my script will make a get request to some url and log in. However my script is failing to send the email and log in automatically due to the Google Chrome pop up about insecure content blocked since one of the images on the page is using http and not https.
I was able to run the script successfully months ago however just recently when trying again, it is unable to proceed with logging in so I dont know why it stopped working all of a sudden.
The error that I see in terminal is this. In irb, I can go through each line of code successfully including using Selenium's "send_keys" and "click" to automatically sign in.
[2018-09-26T13:02:55.002527 #14131] INFO -- : [#http://company.com/favicon.ico'. This request has been blocked; the content must be served over HTTPS.">]
web_app.rb:54:in `': Console Errors Found! (Exception)
I tried searching for some solution but have been unsuccessful. There has been some variations of responses to similar problem but not too much luck with getting it to work.
Any feedback on how to fix would be appreciated.
start Chrome manualy and disable the warning - https://www.thewindowsclub.com/disable-insecure-content-warning-chrome
and use the set browser profile, there is my setup:
#BeforeClass
public static void setUpClass() {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\pburgr\\Desktop\\chromedriver\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=C:\\Users\\pburgr\\AppData\\Local\\Google\\Chrome\\User Data");
driver = new ChromeDriver(options);
driver.manage().window().maximize();}
We have multiple marketplace Apps that use Gmail Contextual Gadgets. These have been running for years successfully.
We are now noticing the following intermittent error being thrown when calling out to an external web server using open social osapi.http.post
"{"id":"http.post","error":{"message":"Response not valid JSON","code":406}}"
We have checked and there is nothing wrong with our server. We can make the call directly to our server successfully without fail.
We can replicate the issue calling to multiple servers running different apps/gadgets. The only commonality appears to be the use of osapi.http.post.
Here is the post
osapi.http.post({
'body': postdata,
'href': serverUrl + 'iLinkStreamer.ashx?data=' + "" + setTimeStamp() + debugString,
'format': 'json',
'authz': 'signed',
'noCache': true
}).execute(displayStreamList);
which raises the 406 error as above
Has anybody else noticed this issue?? Not sure how we can address it?
I had the same issue for a while and finally found the problem. I was also invoking external resources using osapi.http.post. I read the new documentation and found that there is a new way to do the same.
Check this url for more details, but the idea is that now you'll need to use makeRequest API, it will look something like this:
var params = {};
params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.JSON;
params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;
params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
gadgets.io.makeRequest("https://your.backend.com", on_response_function, params);
...
def on_response_function(response){ ... }
I hope this helps someone.
I'm not sure if I'm the only one, but I never received a notification message that the previous API will be deprecated. :(
This seems to be a very old issue however, all the said solutions are not working for me. I am making a request to a client and receive a HTTPS reponse that I used fiddler to capture early on, however now my application doesn't work without Fiddler certificates. When I select the descrypt HTTPS traffic in fiddler then the app works or else it doesn't even if I remove the HTTPS capture option from Fiddler and remove the fiddler certificate.
I have also tried to remove fiddler altogether but that din't solve the issue as well. I am out of options as of now. This is my code
Dim cert As X509Certificate = X509Certificate.CreateFromCertFile("Cert Location")
ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf OnCertificateValidation)
ServicePointManager.Expect100Continue = False
Dim request As HttpWebRequest = CType(HttpWebRequest.Create(WebURL), HttpWebRequest)
request.Method = "POST"
Dim requestDataByte() As Byte = Encoding.UTF8.GetBytes(CreateRequestXML)
request.ContentLength = requestDataByte.Length
Dim requestdata As Stream = request.GetRequestStream()
requestdata.Write(requestDataByte, 0, requestDataByte.Length)
requestdata.Close()
request.GetRequestStream.Close()
request.ClientCertificates.Add(cert)
request.KeepAlive = False
Dim response As HttpWebResponse = CType(request.GetResponse, HttpWebResponse)
If response.StatusCode > 400 Then
MsgBox("Error:" + response.StatusDescription + vbCrLf + response.StatusCode)
End If
Dim response_stream As Stream = response.GetResponseStream
response_stream.Close()
response.Close()
Dim reader As StreamReader = New StreamReader(response_stream)
_response = reader.ReadToEnd
reader.Close()
I keep receiving the 500 internal server error.
Edit: I was not closing the response connection properly before however I modified that part of the code long back. Shouldn't that modification have solved my problem?
I have modified the code as per the posts I could find online. But still unable to resolve the issue.
It's unlikely that Fiddler's certificate has anything to do with this. The more likely explanation is that there's a problem in the way that your code is providing a client certificate to the server; that problem is remedied when Fiddler is in the middle (because Fiddler cannot take the client certificate sent by your application and pass it to the server).
So, stepping back, when you're running Fiddler, do you have a %AppData%\Documents\Fiddler\ClientCertificate.cer file on your disk? If so, Fiddler is sending that client certificate to the server. If not, then your server isn't getting a client certificate at all.
The solution to the above problem is to have the ClientCertificates.add() method just after you define the request object. And to close your response streams properly by calling the appropriate .Close() methods.
I am writing small html websocket application. This html page works fine at IE window but if same page is tried to open using IWebBrowser2::Navigate then it throws an error "WebSocket is undefined" in standard java script error message box.
Following is sample javascript code:
function myFunction()
{
ws = new WebSocket("ws://" + "127.0.0.1"+ "8070" +"/" + "NSCOMString");
}
Could you please let me whether websocket is implemented inside the navigate method?
Regards,
Anand Choubey
The IWebBrowser2 control by default runs in compatibility mode, see this article on the IEBlog for details on how to circumvent this behavior.