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

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/

Related

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.

Robot framework - Ride - unable to OpenBrowser - nothing specific in the log

I'm trying to run this simple test on RIDE, but I cannot figure out it's failing without giving me any specific details:
Ride Log
command: pybot.bat --argumentfile c:\users\user\appdata\local\temp\RIDEe2en9t.d\argfile.txt --listener C:\Python27\lib\site-packages\robotide\contrib\testrunner\TestRunnerAgent.py:49555:False C:\Python27\Scripts\test\Login\login_suite.robot
========================================================================================================================================================================
Login Suite
========================================================================================================================================================================
login_user | FAIL |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="/assets/displayhelpservlet.css" media="all"/>
<link href="/assets/favicon.ico" rel="icon" type="image/x-icon" />
<script src="/assets/jquery-3.1.1.min.js" type="text/javascript"></script>
<script src="/assets/displayhelpservlet.js" type="text/javascript"></script>
<script type="text/javascript">
var json = Object.freeze('{"consoleLink":"/wd/hub","type":"Standalone","version":"3.11.0","class":"org.openqa.grid.web.servlet.DisplayHelpServlet$DisplayHelpServletConfig"}');
</script>
</head>
<body>
<div id="content">
<div id="help-heading">
<h1><span id="logo"></span></h1>
[ Message content over the limit has been removed. ]
</span>
</p>
<p>
Happy Testing!
</p>
</div>
<div>
<footer id="help-footer">
Selenium is made possible through the efforts of our open source community, contributions from
these people, and our
sponsors.
</footer>
</div>
</div>
</body>
</html>
Selenium server is started (standalone-3.11.0)
Python version 2.7
Environment Path is set Python27/Scripts
Here is the test code:
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
login_user
SeleniumLibrary.Open Browser Google.com googlechrome
Maximize Browser Window
Title Should Be Google
The webdriver for Chrome is also set in Scripts folder, but I've tried it with Firefox as well and got the same result.
EDIT:
so i have tried with this code
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
login_user
SeleniumLibrary.Open Browser https://google.com googlechrome
Maximize Browser Window
Title Should Be Google
If you have
Selenium
Robot Framework
RIDE (for running robot files)
Chrome
The only thing you have to do is download chromedriver.
https://chromedriver.storage.googleapis.com/index.html?path=2.38/
After you have download the chromedriver put it to a folder and add it to your path.
The way i have done after unzipping chromedriver
Ubuntu:
sudo mv chromedriver /usr/local/bin/
sudo chown root:root /usr/local/bin/chromedriver
Windows:
put chromedriver.exe into a folder in this example C:\drivers\
Press Windows button on your keyboard and type Edit the system environment variables
Under Advanced tab, Click Environment Variables
List item
Under System Variables find "Path" and click on Path and Edit button
Click new and add the path where you have put the chromedriver
in this example C:\drivers\chromedriver

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

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

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>

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.