Is there a way to use commas in number type input in macOS Safari without javascript? - input-field

This is my input field:
<input id="x" name="x" step="any" lang="hu" type="number" value="50">
Safari doesn't accept commas, and I didn't find a good native solution for this yet. I'm triing to avoid javascripts and cross-browser compatible is really important for me.
Thank you!

Related

Not able to find xpath. Chropath message - This element might be inside iframe from different src. Currently ChroPath doesn't support for them

Below is the HTML snippet I am trying to get xpath. I have tried so many combination in chrome dev tools but no luck. Chropath message is that element might be from different src.
I am not sure what it means. Any help appreciated.
<input type="text" class="sn-global-typeahead-input -global-active-input" name="sncwsgs-
typeahead-input" id="sncwsgs-typeahead-input" placeholder="Search Global" autocomplete="off"
aria-label="Search" aria-hidden="false" aria-expanded="true" aria-activedescendant="sncwsgs-
typeahead-record-1-2" aria-autocomplete="both" aria-owns="sncwsgs-typeahead-sections" aria-
controls="sncwsgs-typeahead-sections" aria-describedby="sncwsgs-typeahead-instructions" aria-
haspopup="listbox" value="" role="combobox">
There's an id tag, so you can use the following for the XPath:
"//input[#id='sncwsgs-typeahead-input']"
That also translates to the following CSS Selector:
"input#sncwsgs-typeahead-input"
But if that's inside an iframe, you'll need to switch to the iframe first before you can interact with elements inside of it.
Learn about switching into iframes here: https://www.selenium.dev/documentation/webdriver/interactions/frames/
Example of switching into an iframe:
driver.switch_to.frame("iframe")

Xpath: not supported by FireFox, but Chrome OK

WebDriver Xpath: not supported by FireFox:
//div[#class='foo']//*[name()='div' or name()='span' or name()='input' and #type='text']
But this is working for Chrome. Is this Xpath 1.0?
how to fix it for firefox? Is there a way to verify xpath in firefox browser?
It's legal XPath 1.0. You might like to add parentheses in the condition to make quite sure that you, the reader, and the XPath processor all share the same understanding of the operator precedence of "or" and "and".
Can't help you diagnose a problem if you don't tell us the symptoms.
Here are the options.
<html><head></head><body>
<div class="foo">
<div><input type="text"></div>
<span type="text"></span>
<label> ... </label>
<div type="text"></div>
<input type="text">
</div>
</body></html>
Option 1:
//div[#class='foo']//*[#type='text'][local-name()='div' or local-name()='span' or local-name()='input']
Option 2:
//div[#class='foo']//div[#type='text']|//div[#class='foo']//span[#type='text']|//div[#class='foo']//input[#type='text']

Different Ways of creating Buttons in DOJO Framework

Hi , i found these two ways for creating Button in DOJO Framework
<input id="cb" dojotype="dijit.form.Button" name="developer" type="Button" />
<button dojoType="Button" widgetId="helloButton" onClick="helloPressed();">Hello World!</button>
Please tell me if there is any difference between these two ways of creating buttons in DOJO ??
From Dojo's dijit.form.Button documentation, the difference is in the html tag underlying dojo's widget. Here <button> vs. <input type="button" />. Which to use? there is an interesting discussion about html button vs html input with type=button.
The main difference is that the second choice lets you write html content between tags.

How to use the DOM locators in Selenium

I've the HTML source like this,
<input type="image" onclick="return logSub();" src="/images/Login_submit.gif" width="105" height="33" border="0" />
Here there is no ID or NAME. So I can only locate this using image index (which is hard) or using the src tag? But I dont know how use the src tag?
Is that possible?
See my answer to a previous question here: selenium: Is it possible to use the regexp in selenium locators
Basically the dom= protocol allows you to use javascript to locate elements for Selenium.
or with css:
css=input[type=image], [src="/images/Login_submit.gif"]
Have you tried
//input[#src='/images/Login_submit.gif']
Try this locator:
//input[contains(#src, 'Login_submit.gif')].

Input button image - not work in Chrome & Safari?

I have the following code in my index.html
<li>
<select name="cmbtype" style="display:none" id="cmbtype" onChange="Changetype()">
<option value="0">
<input type="image" src="images/ocean.png" value="Play" onclick="previewplay(); " />
</option>
</select>
</li>
In firefox, opera and IE 7 I see the ocean.png and am able to click it. When I do, it accordingly plays the mp3 it is supposed to!
When I load this same code in Safari (Windows and Mac), as well as in Chrome the ocean.png is not seen and there is no button to click?
Is there something I can add or do to get this code/design to work in Safari and Chrome?
Thanks
Why do you have the input in your select?
It probably inherits the display: none therefor not getting rendered, which I would assume would be the correct behaviour.
Maybe IE, firefox and opera finds it illegal syntax and rewrite the input outside of the select, but webkit does not.
It is illegal HTML markup and not supposed to work.
<li> stands for list item and must be inside an <ol> (ordered list) or <ul> (unordered list)
<select> can have <optgroup> and <option>
<option> can have characters but no element
In this case Chrome and Safaris way of doing it is the correct way to do it.