QTP UFT - WinList.Select cannot select any line - list

I need a qtf script that selects a line and proceeds. Recording the steps gave the following code:
Window("[windowname]").WinList("ListBox").Select "[Name of the item] "
But when I try to run it I see an error box: Cannot identify the specific item of the ListBox object.
This does not work with any of the lines. I cannot even select one with the arrow down key, the error is always the same.

Please try to highlight WinList from object repository before you run the script. If the object cannot be found, using an updating function to update the object property.
Also, make sure that every time you are running your script for standard window, your screen doesn't minimize.

Related

Error: This operation is not allowed when there are no records displayed. Please execute a query that returns

I have added the following code in the WebApplet_Load of Service Request Applet.It's giving me the above error once, I tries to open the SR screen from the application.
try
   {
      var currBC = this.BusComp();
      with (currBC)
      {
ActivateField("Restrict_drop_down");
ClearToQuery();
//BC.SetViewMode(3);;
TheApplication.SetProfilAttr("SR Type", GetFieldValue("Restrict_drop_down"));
        ExecuteQuery(ForwardBackward);
      }
   }
   catch (e)
   {
      TheApplication().RaiseErrorText(e.errText);
   }
Any idea on how to solve the issue?
You cannot do GetFieldValue when the BC is in Query mode. You have just done ClearToQuery, so you have to execute the query first, check for FirstRecord(); and then do a GetFieldValue();
Also, during the WebApplet load the first BC query is not finished running. It might not be the best place to write this code.
Please check with a siebel expert on your team, such kind of code needs to be placed carefully.

On my Local Host, Error loading notebook - Notebook does not appear to be JSON

I'm new to Python. I wanted to create a simple "Hello World" program in notebook.
For that, I created a file named dataAna.ipynb in C:\Python27 directory.
when i executed jupyter notebook in my Command prompt. When I am opening the file 'dataAna.ipynb' on my localhost, It is showing the following Error.
Unreadable Notebook: C:\Python27\dataAna.ipynb NotJSONError("Notebook does not appear to be JSON: u''...",)
Most basic question I've seen on Stackoverflow. I'll help you out but maybe just search for a getting started guide next time...
I was able to reproduce your "problem" by creating an empty file and naming it to *.ipynb. I also created a notebook file like it was intended to be created via the "New" button
I noticed that the empty manually created file was empty but the file created via "New" button was not. It contained the following content:
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}
Seems that's the minimal information for an empty Notebook file. I won't remember it because I like to use the "New" button
type "jupyter notebook" in terminal and see screenshot above

R Markdown with Shiny Server change host parameter

I am running RStudio on a server and I created a RMarkdown (.Rmd) file. It works fine if I create it as a static HTML but it does not work if I want it to be interactive (by adding runtime:shiny).
The issue is that when I add runtime:shiny and press the Run Document button the application will try to open at 127.0.0.1:xxxx (here xxxx is a random port). In order to make it work I would have to be able to change the host parameter to '0.0.0.0'. This is an option in the runApp function from the shiny package but I don't know how to add this option in RMarkdown.
Can anyone help me with this?
Thank you.
The ::run command from rmarkdown invokes shiny::runApp internally. You can set the option shiny.host before running the document:
options(shiny.host="0.0.0.0")
rmarkdown::run("myfile.Rmd")
You an also pass arbitrary paramters to runApp, so this should work too:
rmarkdown::run("myfile.Rmd", shiny_args=list(host="0.0.0.0"))
Neither of these will work with the Run Document button; that button starts a new R session in which to render the document. To change the shiny.host option in that session, you'll need to add the option to your .Rprofile.
Set the default values you want to initialize in (~/.Rprofile) under user directory
Sys.setenv(TZ = "UTC") # for Timezone
options(shiny.port = 9999)

ApprovalTests - ApprovalMismatchException -

I am writing my first ApprovalTest. I need to understand why I am getting the following error when bothg my files are the same.
move /Y "C:\SampleMvc-master\SampleMvc-master\SampleMvc.Tests\Controllers\GoldenMasterTest.About.received.html" "C:\SampleMvc-master\SampleMvc-master\SampleMvc.Tests\Controllers\GoldenMasterTest.About.approved.html"
move /Y "C:\SampleMvc-master\SampleMvc-master\SampleMvc.Tests\Controllers\GoldenMasterTest.About.received.html" "C:\SampleMvc-master\SampleMvc-master\SampleMvc.Tests\Controllers\GoldenMasterTest.About.approved.html"
Test method SampleMvc.Tests.Controllers.GoldenMasterTest.About threw exception:
ApprovalTests.Core.Exceptions.ApprovalMismatchException: Failed Approval: Received file C:\SampleMvc-master\SampleMvc-master\SampleMvc.Tests\Controllers\GoldenMasterTest.About.received.html does not match approved file C:\SampleMvc-master\SampleMvc-master\SampleMvc.Tests\Controllers\GoldenMasterTest.About.approved.html.
My Code is
[TestMethod]
public void About()
{
//AspApprovals.VerifyUrl("http://localhost:50011/Home/About");
MvcApprovals.VerifyMvcPage(new HomeController().About);
}
ApprovalTests uses a "golden master" style of verification. Meaning that you will always fail the 1st time you run. Once it fails, but produces the right result, you will move the file over and then it will pass and continue to pass until something changes.
There are multiple ways to create the golden master, but one easy way in via the command line, which is why you are seeing the
move /Y "C:\SampleMvc-master\SampleMvc-master\SampleMvc.Tests\Controllers\GoldenMasterTest.About.received.html" "C:\SampleMvc-master\SampleMvc-master\SampleMvc.Tests\Controllers\GoldenMasterTest.About.approved.html"
this creates the .approved files from the .received file.
You might also want to check out this video on reporters which will help explore other ways to create the golden master and view the generated results:
Reporter video
or this video, about verifying MVC pages
MVC Approvals Video
Happy Testing!

Accessing Firefox tab element in nsIWebProgressListener::OnStateChange using C++

I am developing extension for Firefox 3.0-3.5 versions using VS2008.
I want to set attribute to a tab once the document load request completes within that tab window.
So in OnStateChange method, I am checking for document load.
I have used STATE_STOP & STATE_IS_DOCUMENT for it.
I want to determine which tab window has been associated with particular document request.
I have valid DOM Document pointer got from nsIWebProgress *aWebProgress which is 1st input
parameter of OnStateChange.
if ((aStateFlags & STATE_STOP) && (aStateFlags & STATE_IS_DOCUMENT))
{
nsCOMPtr<nsIDOMWindow> domwin;
nsCOMPtr<nsIDOMDocument> domDoc;
aWebProgress->GetDOMWindow(getter_AddRefs(domwin));
domwin->GetDocument(getter_AddRefs(domDoc));
}
I have tried to get nsIDOMDocumentXBL pointer by QIing nsIDOMDocument pointer(domDoc in my example) but it fails with Error code 0x80004002 (2147500034) i.e.NS_ERROR_NO_INTERFACE.
How do I get the tab element corresponding to document load request.
Could any one please help me?
Thanks in Advance,
Vaibhav D. Gade.
IF I understood the question correctly and you want a for a content window, you probably need https://developer.mozilla.org/en/Working_with_windows_in_chrome_code#Accessing_the_elements_of_the_top-level_document_from_a_child_window to get the chrome window, then run the implementation of gBrowser.getBrowserForDocument in the chrome window.
You'd save yourself a lot of time if you stopped writing C++ and switched to JS for such things.