I am developing a selenium application in c#. Scenario in my app is like I am browsing to a web page and press a button so that the next window appears.
So,I want selenium to do like this..Once I click the button in my first webpage that browser should be closed and selenium should focus on the next appeared window. How can I achieve that??Any idea on this will be really appreciated..
Please look the following link
http://www.thoughtworks-studios.com/twist/2.3/help/how_do_i_handle_popup_in_selenium2.html
I hope This will be helpful to you,
Related
I'm using Selenium with VBA and Microsoft Edge to collect information, and download some files from a webpage. Everything works great except for the downloading part.
On this example site: https://file-examples.com/index.php/sample-documents-download/sample-doc-download/, Code like
oWebDriver.FindElementByXPath("//a[#href=""https://file-examples-com.github.io/uploads/2017/02/file-sample_100kB.doc""]").Click
will result in a popup like this:
Unfortunately, it is not possible to simply change the browser's preferences in my case, because the macro will be running on a machine with limited authorization and the following setting can not be changed:
The last option can be translated to: "Ask for the storage location with every download" and it is locked.
It seems that the "Save As" popup in the first screenshot can't be accessed, neither with Selenium nor with SendKeys.
So the only option seems to be using the Windows API with VBA to somehow automate this step, however, even so, it seems to be impossible to get a handle on this pesky popup. I tried finding the window with Spy++ and it doesn't seem to show up as a separate window:
The only solution I can now think of is getting the window size of the parent Edge browser window, navigating the mouse to the approximate position of the "Save As" button, and clicking it there using VBA and the Windows API. Obviously, This is not a great solution, as it would be quite frail and can easily break with the smallest misalignment.
Is there any other way to automate this step that doesn't require moving the mouse and automating the "manual" clicking, using only VBA with Selenium?
Selenium only works for browser web page automation. The pop-up is not a part of the wab page so Selenium will not be able to recognize it.
And I think any setting in Selenium including "download.prompt_for_download" won't have effect. The pop-up is controlled by the browser setting, and the browser setting is controlled by your group policy, you can't override it with Selenium settings.
I think the only way is to use some 3rd party UI automation library to click that option along with Selenium, just like what you said in the question.
I want to mimic mouse clicks on buttons etc. on a website which is already open in a browser(e.g. Chrome). Do you guys know if I can do this with Selenium? Or do you guys know how I can do this in general?
No, you have to launch the browser with selenium by initializing the driver. Selenium is proxying the browser so that your code can control it.
http://selenium-python.readthedocs.io/getting-started.html
I was trying to automate the process of adding Chrome extension through Selenium Webdriver. There comes a dialog that asks user to click 'Add' to add extension. I am facing issue in this part.
Here are the things that I've tried but did not work :
Trying to treat it as 'Alert' and accepting it.
Trying to get its properties but as it is not part of web page we can not see its properties. its chrome's in-build dialog.
Keyboard simulator (hitting Enter)
I know we can use AutoIt but don't want to integrate it with framework just for single issue. Is there any other way you folks can suggest. One workaround that I an thinking if we can get a global keyboard shortcut to select 'Add' on the chrome extension dialog.
I was wondering if there is a way to divide the popup window into more than one tab, when each tab functions as a different web page, using chrome extension APIs. Does somebody know if that's possible?
If I can't do that, I thought I will give up the division into separate web pages and just use tabs on the same web page, like UI tabs for example.
Can you suggest a third way?
Browser\Page Action Windows are Windows of type Popup, you cannot add further tabs to the popup window.
As pointed out using some sort of UI Tabs will solve your problem. Let me know if you need more information.
I'm new to Dreamweaver CS4 and making my first website. I've watched a lot of tutorials and they all just click the Preview in Browser button and they can see what their page looks like in Firefox/IE/etc.
But when I click Preview in Browser a new Firefox window opens up and it goes to my homepage and that's it.
What do I need to setup in order be able to preview in firefox?
THANKS!
I don't use Dreamweaver, although I have it as part of CS4. But I just now opened up the app, created a test HTML page, saved it, and hit F12 (Preview in Browser). And there was my test page. I honestly don't know what you could be doing wrong. I thought it might be that you didn't save your file, but you get a warning dialog if you try to preview without doing that.
After some playing around I fixed the problem myself.
First I had to go to manage site and edit the basic preferences on my website.
I had to make sure the 'URL to browse to the root of your site" is valid.
In my case it I had to add:
file:///C:/Documents%20and%20Settings/Linda/My%20Documents/website1/