Can I make popup screen or file upload automatically with selenium? - selenium

Good morning. I have a web page control with selenium. However, when I click the button of the site, a pop-up screen appears and I want to test that the file attachment is saved by pressing the file attachment button in it. Can you control selenium with two windows (parent, child-popup) going up and down?

I guess you want to interact with file upload dialog which is native window via selenium. That is not possible. However you can select file to upload using sendKeys without the dialog being opened.
Something like that
fileInput.sendKeys("/path/to/local/file");

Related

How to get rid of google pop-ups while testing and navigation google url?

Every time I navigate to google through Selenium, I encounter this popup. I can't click on the search bar. Is there a way to close permanently this popup without using any JS alert method etc.?
I tried some extensions but it didn't work
Click the Lock button (🔒) on the top-left of the search box
Click on 'Cookies'
Make sure you're on 'allowed' and find anything on the lines of google.com
Click Block, Done and refresh the page
Additionally, you may want to try it first without the web-driver 'Chrome is being controlled by automated test software' mode, so open Google Chrome you way you usually would.

Uploading a file with webdriverio and open modal

I'm having this problem:
At the website I'm trying to test with webdriverio, it has this functionality:
You click a button to upload a file (a window opens to choose your local file)
You select your file and click Accept.
When you click Accept, a modal opens and gives you a progress bar and also some mandatory inputs to continue the process and the test.
In other cases, uploading the file with this:
https://webdriver.io/blog/2019/06/25/file-upload/
it works fine!
But in this case, I need to open the modal after you click Accept at the window (anyway I'm not really clicking on Accept button at the locals file window, so probably this should be solve before, but I don't know how to do it)… and its not happening.
Thanks for the help!

Selenium Upload a file using button type and button tag instead of file

I have a webpage where I click on a button and an open dialog it's opened and I should select the file to upload. After that, a pop up is displayed saying OK or KO.
I'm able to upload files when the there are files types. But in this case, the element where I click it's:
<
button type="button" read-file="_.partial(submitLang, selectedLang)" id="import-lang" class="btn btn-default"><
/button>
For the rest of the application, I use this and it works:
WebElement element = getPage().findElementById(id);
element.sendKeys(absoluteFile);
But for button types and button tag it doesn't work.
How can I do it? The tests are running on a Linux machine
Thanks a lot!
More info!!
Hi all,
The whole process is: (see image at http://imageshack.com/a/img540/6237/JoTQng.png)
Click on Import button
A dialog is opened and I select a .json file and click Open
An alert is displayed saying "Text properties have been updated".
We are using angular for the frontend and all are REST calls.
We don't have any "file=type". All three are buttons. You can found more code at
http://imageshack.com/a/img633/7299/BQhP7o.png
For a file upload with selenium, you need to find an input tag with the type "file".
Have a look at your HTML and search for it.
When you found it, the rest is pretty straightforward:
Let's say this input-element has id="import"
driver.findElement(By.id("import")).sendKeys(absoluteFile);
If you run into problems, please post more of your HTML, then I can have a look at it.
In my case, clicking on the button made an element appear in the HTML code, I assume due to javascript.
I clicked on the element (which both opens a file upload window and adds the to the HTML), and immediately after send the keys to the input element.
This creates the problem of having to close the newly opened file upload window, however this is not a problem when using --headless mode on google chrome.
I do not have a solution to close this window if you are not in headless mode for your chosen browser.

How to click on Open/save/save as/cancel button on IE 11 using vba

I would like to click on open when a file download dialog appear in IE 11. I found this code http://www.siddharthrout.com/2011/10/23/vbavb-netvb6click-opensavecancel-button-on-ie-download-window/
But this code does not work with IE11. I have also attached the IE11 download dialog box here too. Anyone has any idea, please, help.
You can use Alt+N to focus on the Notification Bar.
And then send {tab} key to navigate to the specific button.
With VBA, you may use Autohotkey.dll or AutoItX3.dll to send these hotkey combinations.

Uploadify - file select dialog goes behind the popup window

I am using uploadify in a child window. that is if i click on a image it will open a new window using javascript.. inside the child popup window, i am having the uploadify.
everything works fine. but when clicking Browser Files flash button, the file select dialog goes behind the child window. anybody please help to focus the file select dialog to the current popup window.
Do you have a link so we can test this? It seems like a problem on how your computer is rendering dialogs.
I believe the browser can't control whether the dialog will be created on top of all windows or behind all windows.