I am newbie to selenium..
I do have a home page which has create account. If i click Create Account which pops up me to enter Email address and password and submit button.
I have used below one navigate to first iframe.
driver.switchTo().frame(0);
It is working perfectly for me.
On click of submit button on iframe 1, there is another iframe which shows me to enter firstName, lastName, gender, and One time passsword.
I am using below snippet to navigate to the iframe and to enter firstName. it is not working
driver.switchTo().defaultContent();
driver.switchTo().frame("login-iframe");
driver.findElement(By.xpath("//input[#id='fname']")).sendKeys("Test");
Can any one tell me is it correct or not?? I have tried setting back to defaultContent and not setting to defaultContent() both..
Source code here:
<iframe id="login-iframe" style="width: 800px;height: 530px;">
</iframe></div></div>
<div id="user-verify-modal" class="md-modal md-effect-10">
<div class="md-content">
<!-- a.close(href="#")-->
<div class="tab-links">
<ul>
<li data-type="" class="hidden active">
Complete your details to create XXX Cash Wallet
<span class="arrow arrow-filled">
</span>
</li>
</ul>
<div class="logo pull-right">
</div>
<div class="clear">
</div>
</div>
<div class="tab-content">
<div id="new-wallet" class="tab-pane active">
<div class="pull-left border-rt">
<div class="row">
<div class="first">
<label>First name </label>
<input id="fname" type="text" value="" name="fname" maxlength="25"/>
<span class="blankfirstName">Enter your First Name</span>
</div>
<div>
<label>Last name</label>
<input id="lname" type="text" value="" name="lname" maxlength="25"/>
</div>
</div>
<div class="row radiobuttons">
<label><input id="male" type="radio" name="gender" value="Male"/>Male</label>
<label><input id="female" type="radio" name="gender" value="Female"/>Female</label>
</div>
<div class="row emailrow"><em class="verified"><i></i>Verified</em>
<input id="userEmail" type="text" value="" name="userEmail"/>
<span class="blankemail">Enter your Email where we will send you a verification link once you proceed</span>
<span class="invalidemail">Enter a valid Email where we will send you a verification link once you proceed</span>
<span class="invalidEmailEntered">The entered Email is invalid. Please enter a valid Email where we will send you a verification link once you procced.</span>
<span class="duplicateEmail">We already have a XXX account with this Email. Enter a different Email or Sign in using this.</span>
<span class="errorEmail">Sorry, there's been an error sending mail.</span>
</div>
<div class="row changeEmailContent">We have sent a verification link to <b> </b>. Please verify the same once you proceed or Change Email
</div>
<div class="row mobilerow"><em class="verified"><i></i>Verified</em><label>Mobile number </label>
<input id="userNumber" type="text" value="" name="userNumber" maxlength="10"/>
<span class="blankNumber">Enter your Mobile</span><span class="invalidNumber">Enter a valid Mobile</span>
<span class="invalidNumberEntered">The entered Mobile is incorrect, update this to verify the new Mobile</span>
<span class="duplicateNumber">This Mobile exists in other xXXX accounts. Update this and to verify the new Mobile</span>
<span class="errorNumber">Sorry, there's been an error sending OTP.</span>
</div>
<div class="row changeMobileContent">Enter One Time Password (OTP) sent to your Mobile <b> </b> or Change Mobile</div><div class="row enterOTP">Resend OTP
<label>Enter OTP</label>
<input id="enterOTP" type="text" name="enterOTP" value="" maxlength="6"/>
<span class="error"></span>
<span class="otpsent">One Time Password (OTP) has been resent. If you still do not receive the OTP within 15 minutes, please contact us at care#xxx.com</span>
</div>
<div style="margin-bottom:0px;" class="row"><div class="first"><button id="skipVerifyDetails" type="submit" class="btn btn-primary">Skip</button>
</div>
<div><button id="confirmVerifyDetails" type="submit" class="btn btn-primary">Confirm</button></div>
From your html source, it looks like input with id fname is NOT part of iframe with name login-iframe because it ends and the input is below that in the default content.
<iframe id="login-iframe" style="width: 800px;height: 530px;">
</iframe>
So I think you should search for the input within defaultContent. Did you try this?
driver.switchTo().defaultContent();
driver.findElement(By.xpath("//input[#id='fname']")).sendKeys("Test");
On a side note you could use just By.id instead of By.xpath to find the element since it has id.
Related
I have a form login. Normaly, the chrome save the settings, and each time the user access to that form, the last input values are automatically insert. But in my form, the browser does not behaves like that.
[Edit] : This behavior it is just appending to chrome browser
Follows the HTML code:
<form action="#" class="ac-custom ac-checkbox ac-checkmark" onsubmit="UIAuthetication.prototype.ClickButtonSignedIn(true); return false;">
<div class="username line checkThisDiv">
<input class="input TR_Login_Username" type="text" required="" placeholder="E-mail" mandatory="" vk_15c42="subscribed">
<h6 class="TR_Login_Username">E-mail</h6>
<p class="error_message"></p>
</div>
<div class="password line checkThisDiv">
<input class="input TR_Login_Password" type="password" required="" placeholder="Password" mandatory="" vk_15c42="subscribed">
<h6 class="TR_Login_Password">Password</h6>
<p class="error_message"></p>
</div>
<div class="line line-submit">
<input class="submit right TR_Login_Button" type="submit" value="Login">
<ul>
<li>
<input class="keepSignIn remember" type="checkbox">
<label class="TR_Login_Keep_Me_Signed_In" for="cb6">Remember user</label>
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"></svg></li>
</ul>
</div>
</form>
So, with the attempt-error method, I discovery if I put ID's to the inputs, the chrome autocomplete will work. I don't know the reason of that, I just know with that, the problem was solve.
I'm working on an ASP site for the company I work at. It's about adding money saving or earning activities to an overview that one of the directors can look at.
Currently though I have some styling issues, using bootstrap here.
I believe I used to have this issue once but how I solved it escapes me. I can't center all the elements and I can't make the input boxes connect with the addons on the right side as is seen in the picture.
<div class="container body-content" style="padding-top: 15px;">
<div class="container" align="center">
<div class="col-lg-8">
<div class="row">
<h2>Abstract</h2>
<div class="form-group">
<div class="input-group" style="padding-bottom: 10px;">
<span id="add-addon-styling" class="input-group-addon">FYE</span>
<select class="form-control required" id="new-activity-fye-dropdown">
<option value="1">On Track</option>
<option value="2">Issue</option>
<option value="3">Behind</option>
</select>
<span class="input-group-addon" data-toggle="tooltip" data-placement="top" title="The Full Year Expectation of the Activity. Usually On Track on creation.">
<b>?</b>
</span>
</div>
<div class="input-group" style="padding-bottom: 10px;">
<span id="add-addon-styling" class="input-group-addon">Activity Name</span>
<input type="text" class="form-control required" id="new-activity-modal-name-field"
aria-describedby="new-activity-modal-name-field" />
<span class="input-group-addon" data-toggle="tooltip" data-placement="top"
title="The Name of the Activity. This name appears in the Activity Overview.">
<b>?</b>
</span>
</div>
<div class="input-group" style="padding-bottom: 10px;">
<span id="add-addon-styling" class="input-group-addon">Responsible</span>
<input type="text" class="form-control required" id="new-activity-modal-responsible-field"
aria-describedby="new-activity-modal-responsible-field" disabled />
<span class="input-group-addon" data-toggle="tooltip" data-placement="top"
title="The responsible person for this activity. This it the go-to person for questions, progress and reports.">
<b>?</b>
</span>
</div>
<!-- TODO: Find an automatic way to make this dropdown -->
<div class="input-group" style="padding-bottom: 10px;">
<span id="add-addon-styling" class="input-group-addon">Department</span>
<select class="form-control required" id="new-activity-modal-department-dropdown">
<!-- Handled in content-controller: CreateNewActivityDepartmentDropdown() -->
</select>
<span class="input-group-addon" data-toggle="tooltip" data-placement="top"
title="The department this activity belongs to.">
<b>?</b>
</span>
</div>
<div class="input-group" style="padding-bottom: 10px;">
<span id="add-addon-styling" class="input-group-addon">Start Time</span>
<input class="form-control" type="text" id="new-activity-modal-datepicker-start" />
<span class="input-group-addon" data-toggle="tooltip" data-placement="top"
title="The start of the activity. Usually today's date.">
<b>?</b>
</span>
</div>
<div class="input-group" style="padding-bottom: 10px;">
<span id="add-addon-styling" class="input-group-addon">End Time</span>
<input class="form-control" type="text" id="new-activity-modal-datepicker-end" />
<span class="input-group-addon" data-toggle="tooltip" data-placement="top"
title="The estimated end of the activity.">
<b>?</b>
</span>
</div>
</div>
</div>
<div class="row">
<h2>Description</h2>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">Upload a thorough description explaining the Activity.</span>
</div>
</div>
</div>
<div class="row">
<h2>Estimation</h2>
<div class="form-group">
<div class="input-group" style="padding-bottom: 10px;">
<span id="add-addon-styling" class="input-group-addon">AX Account Number(s)</span>
<input type="text" class="form-control required" id="new-activity-modal-ax-account-numbers-field"
aria-describedby="new-activity-modal-ax-account-numbers-field" />
<span class="input-group-addon" data-toggle="tooltip" data-placement="top"
title="AX Account number associated with the activity.
Multiple accounts can be added separated by commas.">
<b>?</b>
</span>
</div>
<div class="input-group">
<span class="input-group-addon">Upload the estimation calculations for the Activity.</span>
</div>
</div>
</div>
</div>
</div>
</div>
I feel that my HTML is fairly normal but I have a hard time applying styles from CSS files in ASP in the first place.
How would I make the addons on the right side connect with the input fields?
UPDATE
It appears that the problem was inside a default generated file called Site.css. It had the following in it:
input,
select,
textarea {
max-width: 280px;
}
Commenting that out solves the problem.
Since I don't know how exactly ASP's css structure is, here is how i would approach this situation:
use your browser's inspector to check exactly what type of css rule is making the "?" button be all the way to the right, i can only assume it either has a float, or the form has a huge margin on it's right.
once you have found the issue, you could use your browser's inspector further to test out some edits, if it's a margin thing, see how much margin it will actually need, if it's a float issue, see how it will look with float:none
as soon as you've found the solution to the issue, you will need to apply it, to do this add a custom .css file AFTER ASPs css files, this way whatever you write in it will overwrite any existing rules.
add the fixes to this new file and you should be done.
There must be something elsewhere on the page that is breaking the style of the select boxes, because when I view your snippet in codepen, in both Chrome and IE11, the select boxes do stretch to the question mark boxes at the right:
codepen.io/anon/pen/pgVoQg
btw, inline styles should usually be avoided where possible
Sorry if its a stupid question but I'm unable to figure this simple layout
This is my simply input field with a email field and if the users enters invalid email it shows error as seen below:
<div class="form-group">
<label for="txtEmail" class="col-sm-3 control-label">Email Address:</label>
<div class="col-sm-9">
<div class="input-group col-md-12 form-group has-feedback">
<span class="input-group-addon">
<span class="glyphicon glyphicon-envelope"></span>
</span>
<input type="email" id="txtEmail" class="form-control" placeholder="Enter Email Address" data-minlength="50" data-error="Please enter valid email address" required>
<span class="glyphicon form-control-feedback" aria-hidden="true"></span>
<div class="help-block with-errors"></div>
</div>
</div>
</div>
And the result is displayed as:
I need something as shown below:
I've just implemented a bootstrap-theme in an empty ASP MVC-project. In the bootstrap there is an email-form. I want to activate the "send"-button and make it send an e-mail to me. I've seen different kind of sollutions when I've read about it:
Just use:
<a href="mailto:EMAILADDRESS">
or
form method="post" action="mailto:youremail#youremail.com" >
<input type="submit" value="Send Email" />
</form>
Or the more complicated way, to use jQuery and write things in both the model and controller.
So my question is: Why should I use the (to me) more complicated way?
Here is the code that came with the bootstrap:
<!-- Contact Section -->
#*<section id="contact">
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<h2>Contact Me</h2>
<hr class="star-primary">
</div>
</div>
<div class="row">
<div class="col-lg-8 col-lg-offset-2">
<!-- To configure the contact form email address, go to mail/contact_me.php and update the email address in the PHP file on line 19. -->
<!-- The form should work on most web servers, but if the form is not working you may need to configure your web server differently. -->
<form name="sentMessage" id="contactForm" novalidate>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Name</label>
<input type="text" class="form-control" placeholder="Name" id="name" required data-validation-required-message="Please enter your name.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Email Address</label>
<input type="email" class="form-control" placeholder="Email Address" id="email" required data-validation-required-message="Please enter your email address.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Phone Number</label>
<input type="tel" class="form-control" placeholder="Phone Number" id="phone" required data-validation-required-message="Please enter your phone number.">
<p class="help-block text-danger"></p>
</div>
</div>
<div class="row control-group">
<div class="form-group col-xs-12 floating-label-form-group controls">
<label>Message</label>
<textarea rows="5" class="form-control" placeholder="Message" id="message" required data-validation-required-message="Please enter a message."></textarea>
<p class="help-block text-danger"></p>
</div>
</div>
<br>
<div id="success"></div>
<div class="row">
<div class="form-group col-xs-12">
<button type="submit" class="btn btn-success btn-lg">Send</button>
</div>
</div>
</form>
</div>
</div>
</div>
</section>*#
<!-- Footer -->
Assuming you plan to add more to your email-sending app in the future, you should prefer the seemingly complicated way because in the long run, it will actually make things simpler. This complicated way is based on a concept called 'Separation of Concerns'.
In short, breaking your code into a model and controller is more complicated if you only want a button that sends you an email. But as your program grows in complexity and you add more to it, this technique will make it easier to reuse or update particular aspects of your program.
Does anyone have any ideas of how to create a two panel modal. So for example one side would be a login form or something and the other side would be a list of what users get. Or one side would be a physical contact information div and the other side would be an email contact form. I tried to do two divs under the modal div tag and have one pull-left the other pull-right with each span5 or span6 but it didn't work. I ask because I have this issue. Also can anyone tell me why my contact form has so much space between the label and the input box? Go to scoopclassifieds.com (not trying to plug my site, can't post pics yet) and click contact us. I have placed the html mark up blow
<div class="modal hide fade" id="contactForm" aria-hidden="true">
<div class="modal-body">
<form action="" method="post" class="form-horizontal">
<div class="control-group">
<label class="control-label">Email:</label>
<div class="controls">
<input type="text" name="email" id="email" class="input" />
</div>
</div>
<div class="control-group">
<label class="control-label">Subject:</label>
<div class="controls">
<input type="text" name="subject" id="subject" class="input" />
</div>
</div>
<div class="control-group">
<label class="control-label">Message:</label><br/><br/>
<div class="controls">
<textarea rows="5" class="input span4" name="message" id="message"></textarea>
</div>
</div>
<div class="control-group"><div class="controls"><input type="submit" name="contactUs" id="contactUs" class="btn" value="Contact Us" /></div></div>
</form>
</div>
</div>
Sorry if the code is so horribly formatted. I used cpanel text editor to develop it. I know its a bad idea but I had to do it as fast as possible to provide a live example.
Try putting a row-fluid inside the modal-body, and then 2 span6 inside that..
<div class="modal-body">
<div class="row-fluid">
<form class="span6">
</form>
<div class="span6">
</div>
</div>
</div>
You may also want to increase the default width of the modal..
.modal {
width:45%;
left:45%;
}
Demo on Bootply: http://bootply.com/69517