Tricky Textbox with imacros - captcha

i have a little tricky Captcha Textbox i want to fill with iMacros. The Textbox hax the following Code:
<input data-prevent-submit="false" class="captcha_input form-element form-element-textfield textfield js-component" value="" name="chapter:chapter_body:fieldset:fieldset_body:captchaTextFieldItem:captchaText FieldItem_body:captchaTextField" id="ide7" placeholder="Zeichen aus Bild eingeben" data-component="Textfield" type="text">
I can fill the Form with imacros and submit, but it doesn't work. Seems that the Textbox doesn't recognises my Input. Maybe i have to Focus the box first and than fill it up.
My iMacros Code is simple like this:
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:id* ATTR=ID:ide7 CONTENT={{!VAR1}}
TAG POS=1 TYPE=BUTTON FORM=ID:ide3 ATTR=ID:ide4
Thanks in advance for your help!
Cheers, Chris
Heres the Website Code:
<div class="layer-body">
<div class="captcha">
<form id="idf5" method="post" action="./popImap;jsessionid=7694A5FB6B8DC9BBD48C31C42BFCE41A-n1.bs54a?2-1.IFormSubmitListener-topLevelContainer-dialog-root~container-container-form" class="m-form"><div style="width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hidden"><input name="idf5_hf_0" id="idf5_hf_0" type="hidden"></div><div style="width:0px;height:0px;position:absolute;left:-100px;top:-100px;overflow:hidden"><input autocomplete="off" type="text"><input name="chapter:chapter_body:bottomButtons:container:bottomButtons_body:ok" onclick=" var b=document.getElementById('idf6'); if (b!=null&&b.onclick!=null&&typeof(b.onclick) != 'undefined') { var r = Wicket.bind(b.onclick, b)(); if (r != false) b.click(); } else { b.click(); }; return false;" type="submit"></div>
<div class="form-chapter">
<h4 class="headline-layout4 headline">Sicherheitsabfrage</h4>
<p class="paragraph">Helfen Sie uns Spam zu bekämpfen! Bitte geben Sie den angezeigten Code ein.</p>
<div id="idf7" style="display:none"></div>
<fieldset class="m-form-fieldset m-form-fieldset-styled-variant-b">
<div class="m-form-fieldset-styled_wrapper">
<div class="captcha_image-container">
<span class="captcha_spinner"></span>
<img class="captcha_image" id="idf8" src="./popImap;jsessionid=7694A5FB6B8DC9BBD48C31C42BFCE41A-n1.bs54a?2-IResourceListener-topLevelContainer-dialog-root~container-container-form-chapter-chapter_body-fieldset-fieldset_body-captchaImage&antiCache=1457521123954">
</div>
<div class="m-form-item">
<div class="m-form-item_container">
<input data-prevent-submit="false" class="captcha_input form-element form-element-textfield textfield js-component" value="" name="chapter:chapter_body:fieldset:fieldset_body:captchaTextFieldItem:captchaTextFieldItem_body:captchaTextField" id="idf9" placeholder="Zeichen aus Bild eingeben" data-component="Textfield" type="text">
<a id="idf3" href="javascript:;" class="icon-link js-component" data-component="IconLink" icon="refresh">
<i class="m-icon icon-link_icon"></i>
</a>
</div>
</div>
</div>
</fieldset>
<p class="paragraph">Mit dieser Maßnahme schützen wir vor ungewollten Manipulationen</p>
<div class="m-button-container m-button-container-right">
<button name="chapter:chapter_body:bottomButtons:container:bottomButtons_body:cancel" id="idf4" value="Abbrechen" type="button" class="button-size-normal m-button button-transparent js-component button-secondary layer-close" data-component="Button">
Abbrechen
</button>
<button name="chapter:chapter_body:bottomButtons:container:bottomButtons_body:ok" id="idf6" value="Speichern" class="button-size-normal m-button button-cta js-component" data-component="Button">
Speichern
</button>
</div>
</div>
</form>
</div>
</div>
And here the recorded Macro:
URL GOTO=https://navigator.web.de/?sid=8266e33e4a68f4dc2245fcc7e22063633d603457ed697b8c7aa7cf77306e5e1462f3096157b0b1bc031b669d19bc9df1&tz=1#mail
FRAME NAME="mail"
TAG POS=1 TYPE=BUTTON FORM=ID:id89 ATTR=ID:id8a
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ide3 ATTR=ID:ide7 CONTENT=Testinput
TAG POS=1 TYPE=BUTTON FORM=ID:ide3 ATTR=ID:ide4

Select the XPATH of that text field and try the below code.
URL GOTO=https://navigator.web.de/?sid=8266e33e4a68f4dc2245fcc7e22063633d603457ed697b8c7aa7cf77306e5e1462f3096157b0b1bc031b669d19bc9df1&tz=1#mail FRAME NAME="mail"
TAG POS=1 TYPE=BUTTON FORM=ID:id89 ATTR=ID:id8a
EVENTS TYPE=KEYPRESS XPATH="//select[#id="billing:country_id"]" CHARS={{!VAR1}}
TAG POS=1 TYPE=BUTTON FORM=ID:ide3 ATTR=ID:ide4

Many Thanks for your help!
i changed the recording mode and finaly solved it with:
FRAME NAME="mail"
CLICK X=365 Y=317
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:id* ATTR=ID:id* CONTENT={{!VAR1}}
wait seconds=5
TAG POS=1 TYPE=BUTTON FORM=ID:ide3 ATTR=ID:ide4
before TAG TYPE
easy ;-)

Related

Form with radio buttons not submitted

I have a form with two radio buttons which is enabled only when a checkbox is checked.
My problem is when I check the checkbox and click the submit button, the radio value is not getting posted. But after I click on the checkbox and then click on one of the radio buttons then the value is posted.
How to fix this issue?
This is the code I have tried:
HTML
<form [formGroup]="filterProductTargetForm" (ngSubmit)="onSubmitFilterDataList(filterProductTargetForm.value)">
<div class="row">
<div class="col-md-10">
<input type="checkbox" [ngModel]="isProductTypeChecked" formControlName="checkProductType" (change)="onProductTypeChange($event)" />
<label>Select A or B</label>
</div>
</div>
<div class="row">
<label class="col-md-2 uni-label"></label>
<div class="col-md-10 prduct-type-radio">
<fieldset [disabled]="!isProductTypeChecked">
<input type="radio" [checked]="isProductTypeChecked == true" value="A" formControlName="productTypeSelected" [(ngModel)]="productTypeSelected">
<span>B</span>
<br>
<input type="radio" value="B" formControlName="productTypeSelected" [(ngModel)]="productTypeSelected">
<span>B</span>
</fieldset>
</div>
</div>
<button class="uni-button def" [disabled]="!filterProductTargetForm.valid">OK</button>
</form>
TS
ngOnInit() {
this.filterProductTargetForm = this.formBuilder.group({
'checkProductType': '',
'productTypeSelected': ''
});
}
public filterProductTargetForm: FormGroup;
public isProductTypeChecked = false;
onProductTypeChange(event: any) {
this.isProductTypeChecked = !this.isProductTypeChecked;
if(!this.isProductTypeChecked)
this.filterProductTargetForm.controls['productTypeSelected'].reset();
}
First remove all ngModel from your template when using reactive forms.
When the checkbox value changes, in your onProductTypeChange function set the productTypeSelected value
this.filterProductTargetForm.controls['productTypeSelected'].setValue('A');
Working StackBlitz DEMO

Attach-focus not working in aurelia-dialog

I have the following:
<ai-dialog>
<ai-dialog-header style="display:flex;justify-content:space-between">
<span>New Person</span>
<i class="fa fa-close" style="cursor:pointer" click.delegate="controller.cancel()"></i>
</ai-dialog-header>
<ai-dialog-body>
<div style="display:flex;flex-grow: 1">
<div class="field">
<div class="field-title">First Name</div>
<div class="field-value">
<input style="flex-grow:1" type="text" attach-focus="true" value.bind="criteria.firstName & validate" />
</div>
</div>
....
</div>
</ai-dialog-body>
<ai-dialog-footer>
...
</ai-dialog-footer>
When the dialog is displayed, I'm expecting first name input box to have focus but nothing has focus -- I manually have to click in the box to set focus.
Any thoughts?
Try the following: focus.bind="true"
<input style="flex-grow:1" type="text" focus.bind="true"...
You could also make the focus depending on the model what you didn't need here.
Here are more details:
http://aurelia.io/blog/2015/06/05/building-aurelias-focus-attribute/

Can't click the check box in the sign up page

I am writing selenium script for Autotrader.com signup page. I am not able to click on 'I Agree' Check box. This is what I have written:
WebElement cboxlink = driver.findElement(By.id("j_id_29-j_id_2h-"
+ "myatcRegisterForm-j_id_3n-acceptTerms"));
cboxlink.click();
The HTML is:
<div id="j_id_3n" class="atcui atcui-form-row atcui-clearfix atcui-small terms" style="">
<input id="j_id_29-j_id_2h-myatcRegisterForm-j_id_3n-acceptTerms" class="checkbox" type="checkbox" value="true" name="j_id_29-j_id_2h-myatcRegisterForm-j_id_3n-acceptTerms">
<label for="j_id_29-j_id_2h-myatcRegisterForm-j_id_3n-acceptTerms">
I accept terms of the
<a target="_blank" href="/privacy.jsp">Privacy Statement</a>
and <a target="_blank" href="/legal/visitor-agreement.xhtml">Visitor Agreement</a>.
</label>

How to Select Radio button inside Fieldset using behat

Can any one please help me out how to select a radio button if it is inside a fieldset??
I can access individual radio button using foreach but when i try to select it or click it its giving some Ajax error.
HTML code is given below
I have tried to select it with radio button's label as well as given in above comment but not able to select it.
<fieldset id="edit-cvs-options" class="form-wrapper">
<legend>
<div class="fieldset-wrapper">
<div class="ios-content" style="display: none;">test</div>
<div class="form-item form-type-radio form-item-use-stored">
<label for="edit-use-stored">
<span>test</span>
<input id="edit-use-stored" class="form-radio" type="radio" name="use_stored" checked="TRUE" value="on" display-title-fix="1"/>
</label>
</div>
<fieldset id="edit-cvs-1" class="form-wrapper" style="display: inline-block;">
<div>
<div class="form-item form-type-radio form-item-use-uploaded">
<label for="edit-use-uploaded">
<span>test</span>
<input id="edit-use-uploaded" class="form-radio" type="radio" name="use_uploaded" display-title-fix="1" value="off"/>
</label>
</div>
</div>
</fieldset>
This is my Behat step definition:
$session = $this->getSession(); // get the mink session
$escapedValue = $session->getSelectorsHandler()->xpathLiteral('use_uploaded');
$radioButton = $session->getPage()->find('named', array('radio', $escapedValue));
$radioButton ->click();

Selenium test an iterface where misses id and title and other sensible information

I'm working for a client who wants me to do selenium/junit tests but the whole user interface doesn't show any id for the html code nor title for the page, just content like "Welcome in ...", how whould you do to check that one is on the home page or in the page for the login for example?
This is an example of the html:
<div class="site-body m-welcome" data-module="welcome">
<div class="inner">
<h1 class="starred dark"><span>Welcome to ...</span></h1>
<div class="choices">
<div class="choice">
Become a xxxxx
</div>
<span class="or"><span>Or</span></span>
<form action="http://www.alink/welcome" method="post" class="choice" data-response-type="json">
<input type="text" name="plate_number" id="car_plate_validation_plate_number" value="" maxlength="8" class="plate required numberplate" placeholder="Enter number plate">
<button type="submit" class="btn btn-primary">Become an yyyyy</button>
<div class="invalid-message inline-modal" data-behavior="modal">
<h1>Sorry - you are not eligible to join the company</h1>
<p>See am I eligile? for full eligibility critera.</p>
</div>
</form>
</div>
You can use XPath to find almost all elements, I wouldn't use it often but in your case (where nothing has IDs) you'll probably need to use it very often:
IWebElement element = driver.FindElement(By.XPath, "//*[text='Welcome in ...']");
That will get you the first element of any type that has the text within it of "Welcome in ..."
For checking if you are on a certain page, I guess you'll have to search for an element that is unique to that page and no other pages.
You'll need to show us some of the HTML if you want more specific examples.
Example of html:
<div class="site-body m-welcome" data-module="welcome">
<div class="inner">
<h1 class="starred dark"><span>Welcome to ...</span></h1>
<div class="choices">
<div class="choice">
Become a xxxxx
</div>
<span class="or"><span>Or</span></span>
<form action="http://www.alink/welcome" method="post" class="choice" data-response-type="json">
<input type="text" name="plate_number" id="car_plate_validation_plate_number" value="" maxlength="8" class="plate required numberplate" placeholder="Enter number plate">
<button type="submit" class="btn btn-primary">Become an yyyyy</button>
<div class="invalid-message inline-modal" data-behavior="modal">
<h1>Sorry - you are not eligible to join the company</h1>
<p>See am I eligile? for full eligibility critera.</p>
</div>
</form>
</div>