Change manually placeholder text in input "postalCode" in Stripe from "ZIP" or "Postal Code" to "ZIP/Postal" - vue.js

I'm using "#stripe/stripe-js": "^1.9.0" in nuxt.js app...and must change text in placeholder <input class="InputElement is-empty Input Input--empty" autocomplete="postal-code" autocorrect="off" spellcheck="false" type="text" name="postal" data-elements-stable-field-name="postalCode" inputmode="numeric" aria-label="ZIP" placeholder="ZIP" aria-invalid="false" value=""> from "ZIP" to "ZIP/Postal" according my current task). But official DOC did not help me with it and STRIPE-support did not help me also...any ideas how can I change placeholder?) and also in future I need to change this text by other languages )

instead of using the all-in-one card element, you can place the individual cardNumber, cardExpiry and cardCvc elements to the your own postal input element, of which you can customize the label as you want.
Remember to include the value of postalCode that you collected from your own postal code input element when confirming the payment.
See https://stripe.com/docs/js/element/other_element

Related

How to validate input text length in material input?

I am developing an application using angular dart. I am using angular dart material input for getting input from user.
I have a multiline text input for which I use material input and type="text".
I have made this field "required" but the problem is when the user enters white space or enter, the "required" is gone. I need a attribute where i can specify a constraint that at least one non-white space character must be entered.
How to achieve this?
Here is my code where I have used material input:
<material-input
ngControl="textAnswer" [(ngModel)]="answer" multiline
type="text" label="Your answer" required>
</material-input>
As per documentation you can use all input elements attribute with it.
All of the attributes that can be used with normal <input> and <textarea> elements can be used on elements inside <mat-form-field> as well
So use HTML5 pattern attribute to match the custom pattern(regular expression).
<material-input
ngControl="textAnswer" [(ngModel)]="answer" multiline
pattern="[\s\S]*\S[\s\S]*"
type="text" label="Your answer" required>
</material-input>
[\s\S]*\S[\s\S]* will help to match a string with at least one non-space character.
NOTE : To include all other character use [\S\s] since . doesn't include a newline character.

Get selected content in a number input when click

I guess is not too much difficult but your help will be useful as always.
I had before a text input where the user if click in it select all the content from this input to be able to replace faster his content like in the next example:
<input type="text" value="whatever" onclick="this.setSelectionRange(0, this.value.length)">
So, my question will be, how can I do the same behaviour in a numeric input like the next one?
<input type="number" value="1111">
I tried to add obviously this onclick="this.setSelectionRange(0, this.value.length)" but seems only to work on the text inputs.
Actually, was easy.
I found this solution that works good.
<input type="number" value="111" onclick="this.select();">

Geb: How to add new attribute and its value

I have an input element where I need to set one extra attribute and its value.
<input autocomplete="off" id="to_input" name="to" class="form-control arrival ui-autocomplete-input" placeholder="To" data-input-component="searchCondition" data-input-support="suggest" type="text">
I need to add the below attribute:
How can I do this in Geb?
To say a little more details, when I enter TPE in the input text box, some dropdown items appears and when I select one of them like
"Taipei, XXX.. (TPE)"
Than the new attributes are set automatically same as the picture above.
The only way to do it, is using JavaScript executor:
browser.driver.executeScript("your script")
And script using jquery will look like:
$('jquery-selector').attr('attribute-name', 'attribute-value');
Of course make sure to fill in your data in quotes!

Why Behat/Mink cant't find input field by ID, only by name?

I am testing page with behat and filling form.
I have two password inputs in page html.
First is on top:
<input id="login_password_0" class="form-control " type="password" placeholder="Slaptažodis" autocomplete="off" name="password">
Second at the bottom:
<input id="password" class="form-control validate" type="password" value="" name="password">
Then I run behat/mink test with:
And I fill in "password" with "test"
It fills first one and I need second to be filled.
How to understand documentation, that element can be found and filled by 'id|name|label|value'.
P.S. Changing HTML is not an option.
Haven't tested but it looks like that Behat is performing a task only once. He has no idea that there could be two elements with the same name. "Name" attribute should be unique for one form. Otherwise, you'll be posting two elements with the same name.
Without fixing your HTML nothing is possible, unless you implement your own test which overcomes this issue. Now "password" is both "id" and 2x "name" attribute. Selector should be unique.

Can't select label by text when label contains more than text

I am driving myself bonkers with this.
I have three form fields in a form:
Customer: required dropdown field
Weight: required text field
Status: optional text field
Each element has that label. The required fields' labels contain a span with an asterisk.
I'm using Xpather in Chrome. When I search for this, I receive 2 results, when I should get 3:
//*[contains(text(),'t')]
This makes no sense to me At All.
Customer, which is working:
<label for='customer-field'>
<span class='required-marker'>*</span>
Customer
<input id='customer-field' type='text' />
</label>
Weight, which is not working:
<label class='control-label'>
<span id='ctl01_requiredMarker' class='required-marker'>*</span>
Weight
</label>
Status, which is working:
<label class='control-label'>
Status
</label>
The only workaround that works for me is removing the required marker from the Weight label container. However, that doesn't explain how "Customer" gets matched at all.
Noteworthy: I'm trying to automate testing this page, so I can't really remove that span tag.
What's going on? And/or what do I do?
Try changing your XPath to the following:
//*[text()[contains(.,'t')]]
The source of this fix breaks it down far better than I could've done, so refer to that for detailed explanation! I've tested it myself using the XPath Checker extension for Firefox, and it matches your three items.
Try with the below method
driver.findElement(By.xpath("//span[#class='required-marker']/..")).getText().contains("Weight")
Please Let me know above method is working or not.
I think your html is where the issue lies.
This is probably what your html should look like:
<span class='required-marker'>*
<label for='customer-field'>Customer</label>
<input id='customer-field' type='text' />
</span>
<span id='ctl01_requiredMarker' class='required-marker'>*
<label class='control-label'>Weight</label>
</span>
<label class='control-label'>Status</label>
Are you using Selenium or WebDriver? What does WebDriver return as a response? Also make sure you add a "." before the xpath like .//*[contains(text(),'t')]
What does this print?
List<WebElement> elements = driver.findElement(By.xpath(".//*[contains(text(),'t')]"));
s.o.p(elements.size());