Check all radios with the same xpath - robotframework - robotframework

I have 3 radio buttons in a form which have to checked by robotframework. Below is part of the html code:
<div>
<div>
<label for="doc-22-Confirm">
Confirm
<input id="doc-22-Confirm" class="radiocheckbox" type="radio" checked="checked" value="Confirm" name="data[doc-22]"/>
</label>
<label for="doc-22-Reject">
Reject
<input id="doc-22-Reject" class="radiocheckbox" type="radio" value="Reject" name="data[doc-22]"/>
</label>
</div>
<div>
<label for="doc-23-Confirm">
Confirm
<input id="doc-23-Confirm" class="radiocheckbox" type="radio" checked="checked" value="Confirm" name="data[doc-22]"/>
</label>
<label for="doc-23-Reject">
Reject
<input id="doc-23-Reject" class="radiocheckbox" type="radio" value="Reject" name="data[doc-22]"/>
</label>
</div>
</div>
Ids are dynamic. So I'm trying to check all radios with this code but it just select one of them:
click element xpath=//input[contains(#id,'Confirm')]
I even tried this:
click element xpath=//input[contains(#id,'Confirm')][1]
click element xpath=//input[contains(#id,'Confirm')][2]
click element xpath=//input[contains(#id,'Confirm')][3]
But still it doesn't work.

Try the following:
Click element xpath=(//input[contains(#id,'Confirm')])[1]
I added the '( )' , it should solve the issue.

Related

Place holders in wordpress

I have problem with placeholders in Wordpress Onetone theme. When I change text in placehoder tags to my preferred text it works, until I press on that field again and then text resest to it's older text. For example, I change "Email" to word "whatever" , save it, go to website, it shows word "whatever" in input area, and when i press with mouse on that area and then somewhere else, it resets back to "Email". How I could make that my text in placeholder would be permanent?
<div class="contact-area">
<form class="contact-form" method="post" action="">
<input type="text" name="name" id="name" value="" placeholder="Name" size="22" tabindex="1" aria-required="true">
<input type="text" name="email" id="email" value="" placeholder="Email" size="22" tabindex="2" aria-required="true">
<textarea name="message" id="message" cols="39" rows="7" tabindex="4" placeholder="Message"></textarea>
<p class="noticefailed"></p>
<input type="hidden" name="sendto" id="sendto" value="tomas#bandymasvienas.esy.es">
<input type="button" name="submit" id="submit" value="Post">
</form>
</div>
I found a problem. If you want to be text all time same, you need to find your .js file with your desired function and edit text in there and placeholders will show text you want.

Bootstrap form not styled correctly

I'm having some problems with the bootstrap forms. For some reason they all get messed up.
This is what it should look like:
http://i.imgur.com/vjCZvwc.png
This is how it shows up on my page:
http://i.imgur.com/48qtLc7.png
As you can see, it makes the input box smaller and it places 'br' code behind every line. It also puts a random 'p' in it without any closing tag. (nowhere to be found on the page)
My input code:
<form>
<fieldset>
<legend>Legend</legend>
<label>Label name</label>
<input type="text" placeholder="Type something…">
<span class="help-block">Example block-level help text here.</span>
<label class="checkbox">
<input type="checkbox"> Check me out
</label>
<button type="submit" class="btn">Submit</button>
</fieldset>
</form>
The output code in the browser:
<form>
<fieldset>
<legend>Legend</legend>
<p>
<label>Label name</label><br />
<input type="text" placeholder="Type something…"><br />
<span class="help-block">Example block-level help text here.</span><br />
<label class="checkbox"><br />
<input type="checkbox"> Check me out<br />
</label><br />
<button type="submit" class="btn">Submit</button><br />
</fieldset>
</form>
So my question is; What could possibly be causing this and how do I fix it?
I'm using Bootstrap v2.3.2 as a theme on wordpress and followed this tutorial, so most of my code looks like it.
blog.teamtreehouse (dot) com/responsive-wordpress-bootstrap-theme-tutorial
Thank you for taking the time to read this. :)
This is not a problem with Bootstrap, but with your WordPress editor (or how you're using it).
You'll need to use a plain text editor or reconfigure what your editor does to HTML on save.

Value in the submission form

I've create a RSS submission form and I want to show in the input box something like Enter your email here...., and when they click on it that message should be disappear and they can put their email in the box.
Here is the code I'm using at the moment
<div id="RSS">
<form action="http://feedburner.google.com/fb/a/mailverify" class="RSS" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=RSS', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true">
<input type="hidden" name="uri" value="RSS">
<input type="hidden" name="loc" value="en_US">
<input name="email" id="RSS-text" type="text" maxlength="100" style="width:160px !important" value="Enter your email address..." class=""><button type="submit" id="RSS-button">Subscribe</button>
</form>
</div>
The problem is that it doesn't disappear when someone click on it, and I saw many forms including my search form it can be done that way.
You can use the placeholder attribute, but it doesn't support IE:
<input type="text" placeholder="Enter your text here..." />
Otherwise you can use a bit of javascript:
<input type="text" onfocus="if(this.value=='Enter your text here...') this.value='';" onblur="if(this.value=='') this.value='Enter your text here...';" value="Enter your text here..." />

ASP Getting radio checked value

I'm sure someone will help with this:
Basically I got a form which on submit, it directs it to my contact_form.asp which then sends out an email to a specified address, well I got some Radio buttons on that form, and need to get the checked radio button out of a group of about 3 radio buttons.
i.e.
<input type="radio" name="group1" id="serviceDaily" value="Daily"> Daily </input>
<input type="radio" name="group1" id="serviceWeekly" value="Weekly"> Weekly</input>
<input type="radio" name="group1" id="serviceMonthly" value="Monthly"> Monthly</input>
and in my contact_form.asp I am requesting the value like:
group1 = Request("group1")
Am I doing something wrong? i.e. getting the value incorrectly? The response I'm getting is "Group1", not "Daily" as I want to.
I created a test page using the code you supplied and it works fine (see below).
Try a http debugging tool such as fiddler2 to investigate the actual parameters and values passed between the two pages.
<html>
<head></head>
<body>
<form method="post">
<input type="radio" name="group1" id="serviceDaily" value="Daily"> Daily </input>
<input type="radio" name="group1" id="serviceWeekly" value="Weekly"> Weekly</input>
<input type="radio" name="group1" id="serviceMonthly" value="Monthly"> Monthly</input>
<input type="submit" value="submit" />
</form>
</div>
<%
Dim group1
group1 = Request("group1")
Response.Write ("group1='" + group1 + "'")
%>
</body>
</html>

Get the selected input type radio button ASP.NET

I have two radio buttons:
<input type="radio" name="group1" />1
<input type="radio" name="group1" />2
How do I know which one is selected when the form is posted?
The inputs should have values:
<input type="radio" name="group1" value="1" />1
<input type="radio" name="group1" value="2" />2
Then, the value will be posted on the name group1. On Asp.net you can get it using:
Request.Form["group1"]
If you are using runat="server", it can happen that name attribute is changed at client, so you will get null as value.

Resources