TestStack.White.Uia3 WindowsFramework.InternetExplorer Texbox not found - unit-testing

We are writing test cases for WPF application. Inside WPF application we are opening a web browser window (internet explorer) and trying to find input element.
We installed 'TestStack.White.Uia3.0.13.3' package for finding elements inside the browser.
We able to find button element which is rendered inside HTML page like <button class="accbtn" id="SignIn">User SignIn</button>
to find this element we written code like window.Get<Button>(SearchCriteria.ByAutomationId("SignIn").AndOfFramework(WindowsFramework.InternetExplorer));
In a similar way we are trying to find textbox. Which is rendered on html page like <input id="userid" type="email" name="login" value="">
to find this element we written code like var textbox = window.Get<TextBox>(SearchCriteria.ByAutomationId("userid").AndOfFramework(WindowsFramework.InternetExplorer))
But it is not finding element from the page. I see difference like the rendered html have type='email' instead of type='text' but I thought it should find.
Any suggestions?

I fixed this issue using AutomationElement of a window. There is a like https://msdn.microsoft.com/en-us/library/system.windows.automation.automationelement.findfirst(v=vs.110).aspx which describes how to get automationelement.
After I got automationelement followed valuepattern to insert value into textbox

Related

How to make input box work in the result page

I am learning Django and i learn on making small project for lEARNING PURPOSE.
I learned how work with input and use as variable. Now i want to use search box with the same principle.
Please see the link of input based :
https://stackoverflow.com/questions/58813945/changing-form-to-search-box
index.html is the input after inserting info and clicking ok it directs to index2.html which shows the results
What I need to change besides POST to GET to make it work as it works with input function? do i need to change form, models?
My concern also i want to inset search bar in the navigation in index2.html where user can make search from the result page. This is my index2.html page. I tried to put {{form.as_p }} inside the form function but it does not work. I want after putting infro in search box and clicking search glyphicon (which does not work) will stay on the same page index2.html
I searched the internet and read stackoverflow other examples, but they use complicated version, i need a simple one :
1. i want to have search box on index.html page so it does not show me the name in front of input box and
2. i want search box in the index2.html page keep implementing the same function as index.html so a user do not have to go the initial page to search new data.
Any help or tips would be highly appreciated.
Since you're using bootstrap4 I would recommend to use its template tags and form field customization options.
Example:
{% bootstrap_field form.login show_label=False addon_before='<span class="fa fa-user"></span>' %}
Not: this example uses Font Aweseome for icons.
Also you're not using the real power of Django Bootstrap4, see Quickstart. You can always override the version of Booststrap or the CDN used in your settings.py if needed: Settings.

Type file button

Hello I ask pretty much a similar question yesterday and I don't know why it behaves like that at least for me
<label>Upload songs/images
<label for="song" class="button small-12 hollow">Upload File</label>
<input type="file" id="exampleFileUpload" class="show-for-sr">
</label>
And when I try attaching a plug-in (jQuery plugin) to that input element I'm asking for help is because I would really like to use it thanks and I have asked everywhere and tried searching online but no luck.
Was trying to use this with button https://www.fyneworks.com/jquery/multifile/
Any suggestions are welcome.
Full answer available in response to your other question; in short, the label needs to wrap around the file input control, and remove the label's for attribute.

How to select particular element in Selenium with IE Webdriver

In a web page I am trying to test, I need to click on the element defined by the following:
<span id="mx45" class="text powerwhite goto " title="Go To ALT+G " style="display: block; cursor: pointer;" accesskey="G" mxevent="click" targetid="mx45" ev="goto" tabindex="0" ctype="label" align="middle" clicked="true">
I can't use the id because when the server restarts, the id changes. I tried getting the XPATH from Firebug (as I have done for lots of other elements) but that does not get found. All suggestions gratefully received.
EDIT
Thanks to the answers I am now able to select the element, but this has presented a new problem. The element is a link which pops up a menu, but if I try to get Selenium to click on the link, it just flashes (like Selenium is finding it, but can't click on it). If I click the link, my test continues, but I am struggling a bit here to make Selenium actually click the element.
I don't know about the structure of your html,
but given, the title is unique, you could do somthing like this:
driver.find_element_by_xpath("//span[#title='Go To ALT+G ']").click()
you could also go for "tabindex" or "class", if your html-structure allows it.
someParentElement.find_element_by_xpath("//span[#tabindex='0']").click()
someParentElement.find_element_by_xpath("//span[#class='text powerwhite goto ']").click()
Which would for example be the case if you can find a parent-element below which these attributes are unique
Assuming the attributes I am referencing are static I would use CSS selectors referencing attributes like drkthng used
$$(span.text[title='Go To ALT+G ']").
You can also use a static neighboring element as an achor and navigate from it.

How to make the webpage shows "loading" and change content afterwards?

I use the following page as example:
http://isbndb.com/book/the_new_public_health_second_edition
You can see the box "Loading Prices" when you first load the page, and it will change afterwards to show relevant information on the same box as below:
I am trying to building some price comparison engine using django, and I think I need to inform user that the page is now loading, rather than letting user to wait in front of a blank screen.
Can anyone tell me know to do it?
In your HTML
<div id="lazyLoad">
<img src="\path\to\loading.gif">
</div>
On successful ajax call replace the innerHTML of #lazyLoad with the formatted result.

Radio Button-Variable Undefined Error

I keep getting this "Element TSHIRTOPTION is undefined in Form" Error when page first loads up. The radio button values work when I click on each one. When I refresh the browser, error doesnt appear again until I click on link again (like when the page loads up the first time). I have one of the radio buttons "preselected" hoping to solve the undefined error, but no help there. Any suggestions?
A couple of things could be happening here:
your query is running before the form is submitted - make sure your UPDATE only executes after the form is submitted run query
you are trying to use the form.TshirtOption variable before it is defined as in the radio button itself:
<cfif form.TshirtOption is "radio"><cfset checked = 'checked="checked"'/></cfif>
<input name="radio" type="radio" id="radio" value="radio" #checked# />
OR - you are trying to use the variable out of scope i.e. form.TshirtOption vs TshirtOption
we might need to see your full source, but basically you probably need to give the variable a default before you try to use it:
<cfparam name="form.TshirtOption" value="" />
-sean
Code would be helpful, but I bet a
<cfparam name="form.TSHIRTOPTION " default="your_default_value"/>
at the top of the page would fix you right up. :)