cannot ensure the windows explorer popup is in foreground - selenium

I have a selenium webdriver test application written in java. As part of the web application a button click will open a popup "windows explorer" to select folder for upload. The problem is my java selenium application works well when I run from a command window. but when this application is run from jenkins the popup
window is not always in the foremost so the folder upload fails.
StringSelection strSelection = new StringSelection(path);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(strSelection, null);
try {
Thread.sleep(1000);
Robot robot;
robot = new Robot();
// Press CTRL+V
robot.keyPress(KeyEvent.VK_CONTROL);
robot.keyPress(KeyEvent.VK_V);
....

use a vbscript to minimize all windows before the mvn initiation in jenkins. this will ensure popup is in foreground
set oShellApp = CreateObject("Shell.Application")
oShellApp.MinimizeAll

Related

"Make a Call From" Prompt is not displayed when running from automation - Chrome Selenium

thanks in advance.. I get the below prompt when I click on element with url:tel when I open the browser manually
But when I click the same from automation using selenium, I get this prompt. How do I get the prompt that is shown manually.

Selenium leaves control after clicking to file explorer Browse button in MS Edge

Selenium leaves control after clicking to file explorer Browse button in MS Edge. This works fine in Chrome and Firefox but absolutely blocking to run next step in the code. I tried code via all possible ways and below code works to click to Browse button but after this step selenium leaves control because file explorer window opens. Is this Selenium or MS Edge driver issue?
Steps:
1. Open ajax web application through MS Edge (works)
2. Click to browse button through web driver core or java script method (works)
3. Selenium gone, leaves control till we close file explorer button (doesn't work) - this works fine in GC and FF.
4 (Blocked). Send key to type file name or implement AutoIt script (works)
5 (Blocked). Click to open button via AutoIt script (works)
6 (Blocked). File attached fine (works)
Working code:
driver.findElement(By.id("browseID")).click();
AND
WebElement we = null;
((JavascriptExecutor)ClientSessionFactory.session().webDriver()).executeScript("document.getElementsByName('browseName')[0].click()", we);
Environment:
Selenium version - Latest 3.6.0
Browser - MS Edge
MS Edge Driver - Latest Release 15063
Application type - Ajax web
This is actually blocking attachment functionality and it would be great if selenium will fix this. So far i just see Autoit is the solution as a 3rd party software but it is very tedious to add separate scripts for every browse buttons in the application, any code by selenium blocks due to OS dialog appearance.
I encountered the same problem. One solution can be to manipulate the "browse" window using an Auto-It script (for example). Right before click on the "browse" button, execute the Auto-It script and set a "sleep" command in the beginning to wait for 1-2 seconds. Now you can click on "browse" button. Works fine for me.
Same issue. To fix it i pimped the AutoIt script using WinWaitActive() as a first directive to wait til window is active.
I run the script in a parallel process (subprocess.Popen in python) just before opening the file upload

Button is not clicked unless I click on it twice in Firefox, using selenium webdriver and C#

I have a button in a web application which I want to click. I am using Selenium WebDriver, C# and Firefox version 47.0.1.
I tried using explicit wait and also tried using Actions class. But nothing works.
It only works for firefox when I add the below code (click twice)
_NextButton.Click();
_NextButton.Click();
However, it works fine in Chrome browser with : _NextButton.Click();
and fails in chrome for the code used for executing on Firefox.
Kindly help me resolve this issue.
Sometimes their is some problems with IE11 and chrome in selenium is not able to work as expected. so I use double click instead of click in certain scenarios.
Actions action = new Actions(driver); action.moveToElement(driver.findElement(By...path..."))).doubleClick().perform();

Selenium with PhantomJs webdriver

I've just added Selenium via NuGet (version of Selenium 2.42), and can't see HideCommandPromptWindow for PhantomJs (according to this: Selenium Webdriver PhantomJS C# always opens a cmd window. How to get it working (my script works fine, except I want to hide cmd window).

'Error on Page' while running Selenium script in IE8

I am trying to run Selenium Webdriver script in IE8 and soon as the page load is complete I am getting 'Error on Page', which eventually stops the execution of the script. Please note that if I launch the same URL manually, I don't see any error.
This is what I have tried so far
Unchecked Enable Protected Mode
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
driver = new InternetExplorerDriver(capabilities);
driver.get(AppURL);
driver.navigate().to("javascript:document.getElementById('overridelink').click()");
Nothing worked so far, however my script runs perfectly for FF and Chrome.
Please let me know if there is any possible solution to this issue, I am using Windows 7
This is expected. Selenium won't run properly unless you have the protected mode disabled in the internet explorer options.
Disable it and it should work fine.