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. :)
Related
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
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.
For this code:
page1.cfm
<form action="page2.cfm" method="post">
<input type="text" name="name" />
<input type="submit" />
</form>
page2.cfm
<cfset session.name = form.name>
<cflocation url="page3.cfm" addtoken="no">
page3.cfm
<cfdump var="#session.name#">
If you do this:
browse to page1.cfm on any browswer
submit the form with "value1"
open a new tab
browse to page1.cfm and submit the form with "value2"
go back to the first tab and refresh the page
You will notice that the value of session.name changes on the first tab.
In this question, one of the answers is followed by the comment, "If tabbed browsing causes issue with your session variables, you are doing it wrong".
How then, do you do it properly? The objective is to preserve "value1" on the first tab and "value2" on the second.
Hopefully Scott will post his own comment/answer here but I suspect you misinterpreted his comment. What you describe here is exactly how browsing has always worked for me. Before "tabbed" browsing existed this same issue arose when you opened a new browser window without closing the existing one (this happens no matter how many browser windows you open and still happens today). The ColdFusion server will only maintain a single session for every browser instance the user has open. Hence the warning that all of us display when a user logs out of a session based application. Something along the lines of "your session will not be completely closed until you exit all of your browser windows". Or when they log in "you already have an active session, your other session will be terminated". Then came tabbed browsing. Well tabs are nothing more than another browser instance, just like before, only contained within the same window.
So tabbed browsing does not cause an issue with session variables, they are working as designed. This is how it works. This is expected behavior. It is your expectation that is wrong. I am sure there are ways to make it work the way you are expecting, like there always is in programming, but that is going against the way browsers are designed. Is that a direction you really want to go?
Duplicate question - How to differ sessions in browser-tabs?. You will see some examples there but they are all hacks in an attempt to make it work differently than designed.
I have a simple question which I'm hoping someone will nail in not time.
I'm just running through some Acceptance tests with Codeception and I'm attempting to click a submit button of type image:
<div id="payment">
<input name="submit" type="image" value="" alt="Review your order" src="/images/buttons/pay-securely.png">
</div>
Simply using $I->click() results in a failing test:
$I->click('#payment > input[name=submit]');
Any ideas?
I too have run into trouble with unambiguously specifying what I want to be clicked. Here are two workarounds I have found:
Use a CSS class, or better, an ID, as a selector:
$I->click(['id'=>'myButtonID']);
Use JavaScript / JQuery to trigger the click:
$I->executeJS("$('input[name=submit]').click();");
I prefer the former, because it is easier to do, but I use the latter for cases e.g. where I don't have much control over the code being tested.
I've been in touch with Codeception directly with no reply on the matter. With no way of testing this (and the obvious design flaw in using an image submit button - I mean, are we in the 90s or what?!) I've now changed the input to a proper submit button and CSS that bad boy!
Thought I'd answer my own question and leave it here in the (hopefully unlikely) event that another poor soul has inherited shoddy work.
Hey guys I am having an issue when I'm trying to display a cfdiv inside a cfwindow. It just doesn't show up. No errors, nothing to tell me I'm doing something wrong. The div works just fine if I display it in the page outside of the cfwindow. The cfdiv binds to a page that displays notes. If I try to do a cfinclude with the page the cfdiv binds to I get an error saying that the template can't be found, or there needs to be a mapping. I also have a cftext area inside a cfform and I'm trying to do richtext with it, however it doesn't work either inside of the cfwindow. Is cfwindow incapable of doing this, or is there a trick I don't know about. If you need any other information I'll be happy to provide it.
<cfdiv bind="url:/admin/notes/noteDiv.cfm?noteCategory=businessListing#url.listingID#" id="noteDiv">
On the page with the cfdiv you need to add:
<cfajaximport tags="cfform">
That will load up the required Javascript scripts to make cfform work within a window.
fully qualify your path and it will work. I just ran into this issue. I have a cfdiv inside a cfwindow
<cfdiv
id="idGoesHere"
name="nameGoesHEre"
style="height:300px;width:300px;display:none"
bind="url:http://serverName.att.com/folder/NotesTab_Ajax.cfm?Note_Tag_Type_Code={Tag_Note_Type#change}&case=buildAvailableTagList"
bindOnLoad="false"
/>
for some reason stepping the URL back a directory worked too ../folder/NotesTab_Ajax etc
Might need to pull in cfdiv from that cfAjaxProxy call as well.