Obtaining text output via QTP - telnet

I am using QTP to open a telnet window to router, where I am logging into the router and giving some router specific commands. I am doing as follows,
JavaWindow("myApp").JavaButton("telnetBtn").Click
JavaWindow("myApp").JavaEdit("textAreaWindow").Type "admin"
JavaWindow("myApp").JavaEdit("textAreaWindow").Type micReturn
wait 3
JavaWindow("myApp").JavaEdit("textAreaWindow").Type "lab"
JavaWindow("myApp").JavaEdit("textAreaWindow").Type micReturn
wait 3
JavaWindow("myApp").JavaEdit("textAreaWindow").Type "show version"
JavaWindow("myApp").JavaEdit("textAreaWindow").Type micReturn
With this code, I am able to give commands. After this, I need to get the output from this command which is being displayed in the 'textAreaWindow'.
At least, Is it possible to get all the text being displayed in the JavaEdit object ?
How I can get this ?

I think that the value of the JavaEdit should be in available via it's value property. If you use the object spy on the control does the value contain the requested value?
If so you can access it using GetROProperty
MsgBox JavaWindow("myApp").JavaEdit("textAreaWindow").GetROProperty("value")
If this is not the value you want you can examine the underlying Java object via the .Object property
JavaWindow("myApp").JavaEdit("textAreaWindow").Object

Related

Selenium script getting error 'value cannot be null parameter: source' after setting password textbox

I am getting an error "Value cannot be null,parameter name: s" after setting password through selenium script and clicking submit button.
Please help me on this, Thanks
Am using the below code for setting password
var passwordtxt=driver.FindElement(By.Id("txtpassword"));
var JSexecutor= (IJavaScriptExecutor)driver;
JSexecutor.ExecuteScript("arguments[0].setAttribute('value', arguments[1])",passwordtxt,"mypassword");
Based on the error message you provided, it sounds like the item passwordtxt doesn't exist on the page. Value cannot be null is referring to the element you pass into ExecuteScript, which is passwordtxt in this case.
To solve this problem, you will need to change the way you are finding passwordtxt. If you post some more HTML from your page's source, we can help you determine the correct selector to use.

Change text by Command with VS-Code-Extension

I want to implement a second code formatting. This formatting should be executable by an additional command.
I have already registered a DocumentFormattingEditProvider and that is fine.
vscode.languages.registerDocumentFormattingEditProvider({ language: 'sosse' }, {
provideDocumentFormattingEdits(document: vscode.TextDocument) {
return formattingAction(document);
},
});
But in my case I need a second formatting action for one-liners, which is executed by an command.
I thought about using:
vscode.commands.registerCommand(command, callback)
But I don't know how to access and change the document.
But I don't know how to access and change the document.
There's a special variant of registerCommand() that I think is exactly what you're looking for: registerTextEditorCommand(). From the API docs:
Text editor commands are different from ordinary commands as they only execute when there is an active editor when the command is called. Also, the command handler of an editor command has access to the active editor and to an edit-builder.
That means the callback gets passed an instance of a TextEditor as well as a TextEditorEdit.

Get the JDBC Providers for the Cell using wsadmin

I am trying to list the jdbcprovider list at cell scope but it also list the jdbcproviders at node and server scope, how to get rid off the providers at node and server scope from the list?
AdminConfig.list('JDBCProvider', AdminConfig.getid( '/Cell:CellV70A/'))
output:
'"DB2 Universal JDBC Driver Provider(cells/CellV70A/nodes/nodename|resources.xml#JDBCProvider_1302300228086)"\n"DB2 Universal JDBC Driver Provider(cells/CellV70A|resources.xml#JDBCProvider_1263590015775)"\n"WebSphere embedded ConnectJDBC driver for MS SQL Server(cells/CellV70A|resources.xml#JDBCProvider_1272027151294)"'
If you look at the help for the AdminConfig.list command:
wsadmin>print AdminConfig.help('list')
WASX7056I: Method: list
...
Method: list
Arguments: type, scope
Description: Lists all the configuration objects of the type named
by "type" within the scope of the configuration object named by "scope."
...
It says "within the scope". Since node and server-scoped JDBCProviders are within the scope of the cell, they are returned by your command. If you list all JDBCProviders at cell scope using the Admin Console and then look at the Command Assistance, you'll see something like:
Note that scripting list commands may generate more information than is displayed by the administrative console because the console generally filters with respect to scope, templates, and built-in entries. AdminConfig.list('JDBCProvider', AdminConfig.getid('/Cell:MyCell/'))
So you'll need to filter your return list similarly. You could throw together a very simple script to do so:
jdbcProviders = AdminConfig.list('JDBCProvider', AdminConfig.getid('/Cell:MyCell')).split('\r\n')
for jdbcProvider in jdbcProviders:
if "/nodes/" or "/servers/" in jdbcProvider:
continue
print jdbcProvider

VB.Net Mimic Start - Run Command

Is it possible to mimic the Start - Run box in VB.net?
Specifically, I'm trying to mimic pressing Win+R, typing "notepad++ "C:\Users\Steven\Documents\config.cfg" and hitting return.
Is this possible?
I've tried using
System.Diagnostics.Process.Start("notepad++ ""C:\Users\Steven\Documents\config.cfg""")
and
System.Diagnostics.Process.Start("notepad++ C:\Users\Steven\Documents\config.cfg")
and I get an error saying "The system cannot find the file specified" for both of them.
I've tried using
Shell("notepad++ ""C:\Users\Steven\Documents\config.cfg""")
and
Shell("notepad++ C:\Users\Steven\Documents\config.cfg")
and I get an error saying "File not found" for both of them.
When I type notepad++ "C:\Users\Steven\Documents\config.cfg" in the run box and press return, it opens without a problem.
Does anyone know how to do this?
The Process.Start overload you're using expects you to pass a filename, and cannot find a file named "notepad++ C:\Users\Steven\Documents\config.cfg". You need to look at the Process.Start overloads to find one that allows you to pass arguments, such as this one.
So try:
System.Diagnostics.Process.Start("notepad++", "C:\Users\Steven\Documents\config.cfg")

BeanShell PreProcessor updates User define variables

I'm very new at JMeter issues.
In a test script i have a BeanShell PreProcessor element that updates some variables previously defined at a "User Defined Variables" element.
Latter those variables are used in "Http Requests". However, the value that is used in the http request is the default one.
The scripts seems to be working due to some debug print();
My question is if it's necessary to delay the script to be sure that the BeanShell finishes?
Thanks a lot for your attention
There is no need to put any delay to Beanshell Pre-Processor as it's being executed before request. I'd recommend to check your jmeter.log file to see if there are any scripting issues as Beanshell Pre-Processor does not report errors anywhere including View Results Tree listener.
There are at least 2 ways to assure that everything is fine with your Beanshell script:
Put your debug print code after variables replace logic to see if it fires
Use JMeter __Beahshell function right in your HTTP request. If it's ok - View Results Tree will demonstrate beanshell-generated value. If not - the field will be blank and relevant error will be displayed in the log.
Example test case:
Given following Test Plan structure:
Thread Group with 1 user and 1 loop
HTTP GET Request to google.com with path of / and parameter q
If you provide as parameter "q" following beanshell function:
${__BeanShell(System.currentTimeMillis())}
and look into View Results Tree "Request" tab you should see something like:
GET http://www.google.com/?q=1385206045832
and if you change function to something incorrect like:
${__BeanShell(Something.incorrect())}
you'll see a blank request.
The correct way of changing existing variable (or creating new if variable doesn't exist) looks like
vars.put("variablename", "variablevalue");
*Important: * JMeter Variables are Java Strings, if you're trying to set something else (date, integer, whatever) to JMeter Variable you need to cast it to String somehow.
Example:
int i = 5;
vars.put("int_i", String.valueOf(i));
Hope this helps.
You can update the vale of a "user defined variable".
You have to create a bean shell sampler
vars.put("user_defined_variable", "newvalue");
#theINtoy got it right.
http://www.blazemeter.com/blog/queen-jmeters-built-componentshow-use-beanshell
I'm new to jmeter too but as I know variables defined in "User defined variables" are constants, so you can't change them. I recommend to use "User Parameters" in preprocessors or CSV Data Set Config.