Open link in same browser tab - windows

How do I open a link in the same browser tab? I tried this code:
ShellExecute(Handle, 'open', 'http://site.com', '_self', nil, SW_SHOWNORMAL);
But it continues to open the link in a new table.
Thanks.

I've written on this topic before:
ShellExecute has absolutely no notion of "tab." In fact, it doesn't
even have a notion of "default browser." All it does is find whatever
program is configured for file names that start with "http://" and
execute the configured command line.
What the browser does with the new command line is its own choice.
The API function has no control. Sometimes, the browser allows the
user to configure it.
Opening a new tab or window is the safest thing to do. Neither you
nor the browser knows whether the user is still using the previous
tab or window.

A possible entry point is using OLE Automation. Using this technique you can connect with any existing instance of MSIE, so that you can bring the current browsing window to a new url.

Related

Need unix command to disable the popup window

I am very much glad if anyone help me. am fairly new to Unix scripting side. I am trying to get into one url, but before that am getting one popup window(asking for customer details). So, i need to block/disable/ auto close the popup window. Please help me with the command
In Unix environment shell command plays differently. It can launch your browser but it can not set utility inside a browser application. You need to fix it inside your browser window by using tool option. Just search in google like how to block popup in yourbrowserName.

Firefox new debugger - Where did the file tab go?

Feel really stupid for asking but where did the file tabs in the debugger go? I can only open one file at a time. If I try to open another one, the file content is simply replaced with the new file. If I revert back to the old debugger, then I have a file tab for each file I open.
Using Firefox 53.0.3 (64-bit) on Ubunto 16.04LTS
You're actually using the old debugger UI. It's the new frontend that allows to open several files at the same time and looks like this:
To toggle the new debugger UI, go to about:config and set the preference devtools.debugger.new-debugger-frontend to true.
You may also check whether browser.tabs.remote.autostart.2 is set to true, which controls whether Firefox runs in multi-process mode.

How to open mutiple tabs within a browser using Capybara?

I need to open multiple tabs within a single browser and i need switch over all the tabs.
Give me your suggestions. Thanks in advance.
I'm not so strong in capybara. so, i'm giving solution to switch over between tabs using selenium.
For a instance you clicks a button in a web page and it will open a new page.
The new page may open in a new tab in the same browser window or in a new browser window. That is not controlled by selenium. It will control by the browser which you using.
For a instance take firefox, goto tools->ptions-> tabs-> open new windows in a new tab instead check the option. For example, if you clicks a button it will opens a page only in the new tab of a same browser window. For a sake if you unchecked mean it will open a page in the new browser window. Likewise every browser has its own settings.
Try this code:
new Actions(driver)
.sendKeys(driver.findElement(By.tagName("html")), Keys.CONTROL)
.sendKeys(driver.findElement(By.tagName("html")), Keys.NUMPAD2)
.build().perform();
In above Keys.NUMPAD2 refers that you are gonna move to the second tab in the session.
You can move to Third, Fourth, etc... by giving NUMPAD3, NUMPAD4, etc... respectively. Here i am using windows OS, if you are in some other OS use their shortcuts.
I hope this will help you.
You can use this exact function in Ruby:
page.driver.browser.switch_to.window(page.driver.browser.window_handles.last)

Selenium-IDE test can't switch browser windows

I'm writing a Selenium IDE script to test part of our website that opens a window that takes the user to a third party site that we integrate with. The test clicks a link on our website, that opens a new window on the third party site where we need to tick a checkbox and submit a form, at which point the window closes and we then need to check another page on our own website.
Our problem is that the script breaks at the Selenium selectWindow action, because it says that it cannot find a window with the given name. If we then manually run that line in the IDE, it works!
I have added numerous waits, pauses and other tricks to make sure that the window exists and has the correct title when the SelectWindow action is hit, but we still get the above error.
The script is...
click link=activate
waitForPageToLoad
selectWindow Third party activation site
Are there any tricks to getting this to work?
You dont need that waitForPageToLoad as i'm assuming the host page isn't reloading.
You may want to check out the api ( http://release.seleniumhq.org/selenium-remote-control/0.9.2/doc/java/com/thoughtworks/selenium/Selenium.html#selectWindow(java.lang.String) ) entry for the command. This is the java docs, but it the same for selenium IDE.

How to prevent VS2008 from saving bookmarks?

VS2008 automatically saves bookmarks and restores them when I reopen the document. How can I tell it to stop saving them. When I open a doc, I want it without any bookmark, as in previous versions of VS.
I went twice through the whole options set but couldn't find anything related to bookmarks.
TIA.
You should be able to write a macro that handles the DocumentEvents or WindowEvents event interfaces.
In response to (e.g.) DocumentEvents_OnDocumentOpened, which gets a Document object, you should be able to remove all of the bookmarks.
Or, if bookmarks are relative to a window, you might need to handle WindowEvents_OnWindowCreated.
The documentation claims that these are for Microsoft internal use only, but it says the same for BuildEvents, and I've been using those successfully since VS2003.
The CTRL+B CTRL+C key combo clears all the bookmarks. You could use that before saving although it wipes out all the bookmarks in all files and displays a confirm dialog.

Resources