I would like my new tabs created with command-T to open immediately to the right of my current tab, not all the way to the right. I've looked at a lot of tutorials online, but I haven't seen any that work with the internals of Safari like this. How can this be done?
Try this Safari extension: http://canisbos.com/taboptions. It's old but still works on latest Safari.
Related
I'm working on a project using WebKitGTK and I'm having trouble with the WebInspector after having enabled it using the enable-developer-extras property.
I can open it fine, but when I click the close, pop-out into own window, or switch to sidebar buttons they don't do anything. In my application there's literally no way to close WebInspector once you've opened it.
It doesn't appear to be anything I've changed in my code because I remember it working before, but when I check those commits from Git they're now broken as well. At the same time however it does look like something I'm doing because other applications on my computer using WebKitGTK have their WebInspector working perfectly (and yes, I checked out their code).
So my question is: Has anyone faced a similar issue? And does anyone have an idea how it might be fixed?
You're probably hitting this bug. Workaround is to add a dummy call to webkit_web_view_get_inspector somewhere.
There are two parts of switching tabs on chrome (and possibly other drivers too).
You first have to switch the context that the driver is working on, and in my case I also have to change the view so that a certain tab is focused.
You use to be able to just send the short cut keys (ctrl + tab, ctrl + t, etc) to manage switching the views, however that was changed recently.
After causing me a headache for this, and not really finding any good answers to fix this, I came up with some work arounds.
Opening
You use to be able to create tabs on chrome by sending keys the shortcut to the page using the driver. However, it appears that doesn't work any more. Opening tabs in an alternate way is actually fairly easy, by using some Javascript:
((JavascriptExecutor)webdriver).executeScript("window.open();");
You then have to switch the context to the new window you just opened. You do this by using the webdriver.switchTo() method (plenty of documentation on this)
Switching
Another challenge that I faced was switching tabs after the chrome update made it impossible to just use shortcuts. I originally tried using Javascript to give the window a name like:
window.name = 'foo'
And then on a different tab you could do:
window.open('', 'foo')
and it would switch tabs correctly. However the issue with that it would work fine when you are sending it via console, but for whatever reason it would not work when sending it through the JavascriptExecutor.
I found a work around however. It is kind of hacky, but I do not see an alternative as of now. First you want to switch the context to whatever tab you want to be on using the window handles (again plenty of other posts explain how to do this, so I will not go into detail how to get the correct handle) doing this:
webdriver.switchTo().window(windowHandle);
This makes it so now the webdriver is on that tabs context. Then to actually switch the view so that it is synchronized with the context you have to do a bit of a hack. What you do is you open an alert on the context you want to switch views to, and then close the alert. This happens fairly quick so you will not even see the alert open.
((JavascriptExecutor) webdriver()).executeScript("window.alert('Horrible hack to switch tabs')");
webDriver().switchTo().alert().accept();
Closing
Closing is actually very easy. All you do is:
webdriver.close();
Sorry if this is a mundane question.
My issue is that the user can click on the "Help" button, which by default will open in a new tab, the help page.
When firing the test in Firefox, it creates a new window. Which is great as I can use the Select Window keyword and give it the URL. However, with Chrome and Edge, it just makes a new tab.
I read that Tabs aren't supported - But the weird part is, the test on Edge passes fine, it is just Chrome which is having the problem. Is there a reason behind that?
Is there a way to force it to be a Window and not a Tab? Or something?
I read that I can input a keyboard shortcut of CTRL + Tab. But that feels really dirty and would prefer a better way of doing it.
Error:
ValueError: Unable to locate window with URL 'http://...
EDIT
OK - So instead of using the URL param, I tried the title instead. Just on a whim. And it worked (?) I have no idea how it worked and why using the URL didnt and the title did: Here are the lines I used:
Run Keyword If '${Browser}' == 'Chrome'
... Select Window 1.7.1 User Guide
... ELSE
... Select Window 1.7.1 User Guide - Welcome to the User Guide
Still though, both the "Gets" did not produce a link to the newly created tab / window though :/ - Many thanks to shicky and Helio!
Are tabs not handled largely the same as windows? You should be able to identify what is on the screen as #Helio says by using one of the following:
Get Window Identifiers
Get Window Names
Here are some similar questions that should help you get started, post back here with some further detail if you need more help.
How to get the current URL in Robot framework?
How to make chrome display on the top opened in selenium [Mac OS X]
On the website: www.onlineskateschool.com the links work fine on desktops, but when you go to a mobile device, none of the links work.
I have tried a few different versions of bootstrap, but this has not helped yet. Any ideas where my issue could be?
This can be replicated in Chrome Canary on a desktop with the 'nexus 5' selected after pressing f12 for developer tools.
It seems like your javascript with your auto reformatting of the menu links is your culprit. The phone's width is too big to change to the mobile menu (3 barred icon that contains the links which work on mobile) but it is too small to work on the original links (the ones you see on a regular desktop). Try resizing your browser's width and you will see what I am talking about.
You should change the js code that has to do with your reformatting and then your links should work.
I am looking for a tab control that is different from the default NSTabControl. I am looking for a sample or existing control that replicates the newer style tab controls that are used within Safari, Firefox, Camino etc.
From looking into the Safari app bundle resources it seems the tabs are created from images. I would prefer a control that already exists and has been tested rather than re-inventing the wheel though.
Thank you!
Update: I found PSMTabBarControl however this doesn't work on Leopard and is very old, from 2006. Anything that is more recent available?
This publicly-available framework comes to my mind: PSMTabBarControl.
It doesn't seem to be maintained recently, but might serve as a point to start from.