Letter-spacing bug: Webkit browsers ignore letter-spacing less than 1px - letter-spacing

Webkit browsers like Chrome and Safari ignore letter-spacing less than 1px (or 0.1em) while Firefox displays 0.1px steps just fine: http://jsfiddle.net/d5y6n/2/
Is there a possibility to make Webkit browsers recognize letter-spacing less than 1px?
CSS
.spacing-1 {
letter-spacing: 0.1px;
}
HTML
<p class="spacing-1">This is some text …</p>

Related

Selector only working after inspecting/selecting element (selenium)

I work on selenium with java and when I try find element by (ID, xPath, css) all return the same exception:
'Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable
to locate element: {"method":"css selector","selector":"#City"} '
the element inside form where form inside frame,
when I open Dev Tools in Chrome the execution context is set to top. AND my controls are located within form, that is a different context, not accessible from top. when I change context from top to the second option the controls appear
my question: how can I change the execution context from top to second option by selenium with java
so I can locate controls ??
when I use the below code:
driver.switchTo().frame("name of frame");
driver.findElement(By.id("City")).sendKeys("arwa");
the below Exception appear:
Exception in thread "main" org.openqa.selenium.NoSuchWindowException: no such window
HTML CODE
<iframe name="PegaGadgetIfr" id="PegaGadgetIfr" border="0" frameborder="0" src="about:blank" style="height: 1932px; width: 100%; overflow: hidden;" cd_frame_id_="8428a80be89e4d1b565c0da28ec73cc4"></iframe>
html code
<input data-template="" data-test-id="20181209133107059972774" data-ctl="["TextInput"]" type="text" id="City" value="" class="leftJustifyStyle" title="" name="$PpyWorkPage$pAttendanceData$pCity" validationtype="required" placeholder="" maxlength="150" data-changed="false">

Selenium how to upload files to Microsoft Edge

I am using the following code to upload files to a website to a 'file' type element.
The code works fine in Firefox, Chrome and Safari.
However when I run the code against Edge the file is NOT uploaded
driver.setFileDetector(new LocalFileDetector());
selectFile.sendKeys(path);
This error is reported:
The command failed because the specified element is not pointer or keyboard interactable.
If I try using Javascript like this:
document.getElementById('manual_file_selection').sendKeys(path)
I get this: Object doesn't support property or method 'sendKeys'
As stated the same code works fine in Chrome, Firefox and Safari so I don't understand it.
This is the code behind the file upload button:
<div class="jsx-parser">
<div data-xxxxx-element="manual-file-selection">
<div class="button__container">
<label for="manual_file_selection" class="button button--primary" data-dragging="false" data-xxxxx-element="manual-file-selection--label">
<input id="manual_file_selection" type="file" accept="image/jpeg,image/png" data-xxxxx-element="manual-file-selection--input">
<span>Select File</span>
</label>
</div>
</div>
</div>
Anyone had any success uploading files to Edge with Selenium or is it not supported?
Based on your error messages, I'd give some Javascript a try. It's a bit hacky, as we execute JS to reveal the hidden input element, then send keys to it, but I've had success in the past.
// fetch the element
WebElement input = driver.findElement(By.XPath("//input[#type='file']"));
// run JS to reveal the element
JavascriptExecutor executor = (JavaScriptExecutor)driver;
executor.executeScript("arguments[0].style.display = 'block';", input);
// send file path keys
input.sendKeys(path);
It's worth a try. Let me know if this helps at all.

Selenium webdriver java - upload file with phantomjs driver

I am running a selenium webdriver script headless using Phantomjs Driver. I am having issues uploading a file though since on a normal browser (firefox or chrome) it would pop up the OS dialog box that would allow me to locate the file in my machine and upload it.
How to do that with the ghostDriver (Phantomjs Driver)?
Thanks
Always identify & interact with elements of type "file" when uploads are concerned. This would solve your issue of pop ups.
Ex: In my application, upload related elements have the below DOM -
<a id="uploadFileButtonLink" class="uploadFileButtonLink" href="javascript:void(0)" data-uidsfdc="3" style="display: none;">Upload a file</a>
<input id="multiFileInput" class="multifile-upload-input-button" type="file" name="chatterFile_upload" multiple="multiple"/>
<input id="multiUploadBtn" class="btnImportant" type="button" value="Upload Files"/>
In this case, you can use sendKeys method to "multiFileInput" which is of type "file".
This way it would work for all FF, Chrome & also headless browsers.
I am having the same issue and have posted a question for the same. PhantomJS hangs up when using sendKeys() method.
They have an issue logged here - https://github.com/ariya/phantomjs/issues/10993
One of the comments on the issue stated that the below statement worked -
(PhantomJSDriver) driver.executePhantomJS("var page = this; page.uploadFile('input[type=file]', 'path to file');");
You may try the above solution, but it may or may not work.
This code helped me with uploading if 'multiple' attribute was set:
protected void uploadFile(CharSequence... keys) {
if (((WrapsDriver) driver).getWrappedDriver() instanceof PhantomJSDriver) {
StringBuffer s = new StringBuffer(keys.length);
for (int index = 0; index < keys.length; index++) {
s.append(keys[index].toString());
}
((PhantomJSDriver) ((WrapsDriver) driver).getWrappedDriver()).executePhantomJS(
String.format("var page = this; page.uploadFile(arguments[0], '%s');", s.toString()), getElement());
} else {
getElement().sendKeys(keys);
}
}
var webPage = require('webpage');
var page = webPage.create();
page.uploadFile('input[name=image]', '/path/to/some/photo.jpg');
in the new version of phantomjs, you can upload file like this
uploadfile

How to automate file upload in Internet Explorer using Selenium? [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
How to upload a file from a site using Selenium's java inteface
I am new to Selenium.Can you please tel me how to automate file upload in Internet Explorer using Selenium?
It is not easy, and it is not easy for very good reasons - security. If you are able to upload something like this, what's stopping someone uploading your details using the same method?
You have also given us no example to work with so:
Given this sample webpage:
<html>
<head>
<style type="text/css">
.fileSave { color: red; }
</style>
</head>
<label for="fileUpload">File location:
<input type="file" id="fileUpload" />
<br>
<br>
Save file
</body>
</html>
I can do this, in C#:
Driver = new ChromeDriver();
var fileUploadControl = Driver.FindElement(By.Id("fileUpload"));
fileUploadControl.SendKeys("C:\File.txt");
var submitLink = Driver.FindElement(By.ClassName("fileSave"));
submitLink.Click();
This has been asked several times and is also in some Selenium FAQ.
Selenium 2 (WebDriver) Java example:
// assuming driver is a healthy WebDriver instance
WebElement fileInput = driver.findElement(By.xpath("//input[#type='file']"));
fileInput.sendKeys("C:/path/to/file.jpg");
For Selenium RC, see this question.
The idea is to directly send the absolute path to the file to an element which you would usually click at to get the modal window - that is <input type='file' /> element.

How to give body padding to extjs4 promt? rendering issue with prompt in ie7 and firefox?

I am using simple extjs prompt for getting one value from user
Ext.Msg.prompt('Name', 'Please enter your name:', function(btn, text){
if (btn == 'ok'){
// process text value and close...
}});
In chrome it is rendering correctly, but in ie7 and Firefox, the text-box stretches completely without any padding. so that i cant see left & right side of the text-box.
Thanks in Advance.
For IE7 copy this code into your HTML file: (<head> Tag)
<!--[if IE 7]>
<style type="text/css">
.x-window-body-default .x-form-text {
width: 215px !important;
}
</style>
<![endif]-->
We don't have this problem in FireFox. Which version of FireFox are you using? If you are using the older versions, you can use <style> above that only targets FireFox with help of the link below depending on your version:
http://css-tricks.com/snippets/css/css-hacks-targeting-firefox/