How to use Send() to pass a string like "password#99#TT"? - autoit

I am using AutoIt to handle a browser authentication window which Selenium can't access. Below is my AutoIt code.
Send("demo")
Send("{TAB}")
Send("password#99#TT")
It only sends password#; remaining characters 99#TT are skipped. Please let me know how to pass such a string via Send() command.

In the documentation of AutoIt about the Send() function you have an option to send RAW.
See more documentation here
In your case, I would try Send("password#99#TT", 1)
Hope this helps!
Edit
You can try also Send("password{#}99#TT")
I have found just now this answer link, I think it can help you.

Related

Not able to send key using AutoItX with java

I am new to AutoIT. I can access and use the AutoItX in java. But now I am facing problem that I am not able to send the key, The sendkey parameter is not considered as key, instead it is considering as text
e.g in my code x.send("{ALT}n");
In this case key is not getting pressed instead the text {ALT}n is displaying in notepad Please suggest. Thanks for your help in advance.
Rupali
Thnx. that worked for me.
Also we can use
x.controlSend("Window Title","text","","{ENTER}",false);

Http call parameters SoapUI

How can I Parameterize an http call parameter in soapui to read parameters from a txt file for each iteration.
If needed can the parameters be encoded(url or gzip) before the call was sent?
Any help (pointers/links/code) is greatly appreciated? Thank You
Use groovy script test step to read data from txt file and store the data in TestCase property .
Something like this would work:
String fileContents = new File('/path/to/file').text;
testRunner.testCase.setPropertyValue(property_name, fileContents);
More information about groovy script steps here.
You can access this property as ${#TestCase#property_name} in your requests. Then you can use template parameters for your request url - I've already answered about it here.
If i'm not wrong you are asking about parametrization of URL which you send as HTTP Request for your Rest call. Let me explain you with an example :
Suppose you are looking for a resource and invoking the WebService using the GET method by making use of the ResourceID already present in the DB...Parametrize it as below :
http://${#Project#HOST}:${#Project#PORT}/rest/${#Project#WebApplicationName}/Resource/${#TestCase#ResourceID}
where HOST, PORT, WebApplicationName are the Project Level properties and ResourceID is a Test Case Level property(as it may change with the test cases i.e., dynamic in nature).
This is my approach of parametrization instead of taking it from a local file. Hope this helps!

Page transfer in ASP.NET

In Response.redirect ("Page.aspx",bool end response), How do I transfer the page and come back to to the same execution point?
I mean to say how can I use the bool value for my programming purpose.
Please let me know
If i understand "come back to the same execution point" correctly, you might consider using Server.Execute instead.
From MSDN
Executes the handler for a specified resource in the context of the
current request and returns execution to the page that invoked it.
I think you can create a session variable and stock the "starting point"(url) in the variable.
After that you can get the "starting point" from anywhere and go back to this page..
(If it is want you want to do..)
You could to start run all your operation in another thread and then only do response.redirect("someurl"), i.e.
reponse.redirect("some.aspx");
myoperation();
myoperation1();
replace this code on
ThreadPool.QueueUserWorkItem(delegate
{
myoperation();
myoperation1();
});
Response.Redirect("some.aspx");
To answer your specific questions:
you cannot use the bool parameter for your own purposes - it is there to signal whether to end the response back to the client (msdn link)
when you redirect or transfer to a page you still need to go through the page life cycle, you cannot just start at some arbitrary bit of code on the page. As already mentioned in the answer from InSane, use the Execute method instead.

Is it considered bad practice to perform HTTP POST without entity body?

I need to invoke a process which doesn't require any input from the user, just a trigger. I plan to use POST /uri without a body to trigger the process. I want to know if this is considered bad from both HTTP and REST perspectives?
I asked this question on the IETF HTTP working group a few months ago. The short answer is: NO, it's not a bad practice (but I suggest reading the thread for more details).
Using a POST instead of a GET is perfectly reasonable, since it also instructs the server (and gateways along the way) not to return a cached response.
POST is completely OK. In difference of GET with POST you are changing the state of the system (most likely your trigger is "doing" something and changing data).
I used POST already without payload and it "feels" OK. One thing you should do when using POST without payload: Pass header Content-Length: 0. I remember problems with some proxies when I api-client didn't pass it.
If you use POST /uri without a body it is something like using a function which does not take an argument .e.g int post (void); so it is reasonable to have function to your resource class which can change the state of an object without having an argument. If you consider to implement the Unix touch function for a URI, is not it be good choice?
Yes, it's OK to send a POST request without a body and instead use query string parameters. But be careful if your parameters contain characters that are not HTTP valid you will have to encode them.
For example if you need to POST 'hello world' to and end point you would have to make it look like this: http://api.com?param=hello%20world
Support for the answers that POST is OK in this case is that in Python's case, the OpenAPI framework "FastAPI" generates a Swagger GUI (see image) that doesn't contain a Body section when a method (see example below) doesn't have a parameter to accept a body.
the method "post_disable_db" just accepts a path parameter "db_name" and doesn't have a 2nd parameter which would imply a mandatory body.
#router.post('/{db_name}/disable',
status_code=HTTP_200_OK,
response_model=ResponseSuccess,
summary='',
description=''
)
async def post_disable_db(db_name: str):
try:
response: ResponseSuccess = Handlers.databases_handler.post_change_db_enabled_state(db_name, False)
except HTTPException as e:
raise (e)
except Exception as e:
logger.exception(f'Changing state of DB to enabled=False failed due to: {e.__repr__()}')
raise HTTPException(HTTP_500_INTERNAL_SERVER_ERROR, detail=e.__repr__())
return response

ASP.NET: Get *real* raw URL

In ASP.NET, is there any way to get the real raw URL?
For example, if a user browse to "http://example.com/mypage.aspx/%2F", I would like to be able to get "http://example.com/mypage.aspx/%2F" rather than "http://example.com/mypage.aspx//".
I would of course like a clean way to do it, but I can live with a hacky approach using reflection or accessing obscure properties.
At the moment, I try to use the uri in the Authorization-header (which works), but I cannot rely on that always being there.
EDIT:
What I really want to do is to be able to distinguish between "http://example.com/mypage.aspx/%2F" and "http://example.com/mypage.aspx/%2F%2F".
It looks like ASP.NET first converts "%2F%2F" into "//" and then converts the slashes into a single slash.
So just re-encoding it is not going to work.
I wasn't able to test this because it only works in IIS and not the ASP.NET Development Server that is part of Visual Studio, but try:
Request.ServerVariables[ "HTTP_URL" ]
The following code works for me:
IServiceProvider serviceProvider = (IServiceProvider)HttpContext.Current;
HttpWorkerRequest workerRequest = (HttpWorkerRequest)serviceProvider.GetService(typeof(HttpWorkerRequest));
string realUrl = workerRequest.GetServerVariable("HTTP_URL");
Note that this only works when running on the IIS and not under f.x. ASP.NET Development Server!
Thanks to Lucero for the answer in another thread and Zhaph for pointing me to the thread.
See also:
Get the exact url the user typed into the browser
Server.HtmlEncode(Request.RawUrl);
The raw URL is defined as the part of the URL following the domain information. In the URL string http://www.contoso.com/articles/recent.aspx, the raw URL is /articles/recent.aspx. The raw URL includes the query string, if present.
see also:link text
I can't test here, but this might be what you need:
Request.Url.AbsoluteUri
Request.RawUrl will return the application relative path(including querystring info) while Request.Url will return the complete path(including querystring info).
For more information, see "Making sense of ASP.NET paths".
Well, you could just encode it back to the url-encoded version.
Get the url from the request and urlencode only the query string part and then concatenate them

Resources