Opening multiple tabs when using FirefoxProfile in Python

663 views
Skip to first unread message

Jim Byrnes

unread,
Nov 5, 2016, 9:11:51 PM11/5/16
to seleniu...@googlegroups.com
I set up a Firefox profile to use with FirefoxProfile(). It has open in
tabs instead of windows checked. When I run my code multiple windows
still open and the option to open tabs is now unchecked.

I have found some old posts that say it is not possible to open multiple
tabs. I am checking to see if it is still impossible or maybe I am doing
something wrong in my code.

Regards, Jim

Titus Fortner

unread,
Nov 5, 2016, 9:20:33 PM11/5/16
to seleniu...@googlegroups.com
Firefox is unlikely to ever support interacting with multiple tabs with Selenium



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/nvlvts%24jdn%241%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Jim Byrnes

unread,
Nov 5, 2016, 9:58:04 PM11/5/16
to seleniu...@googlegroups.com
On 11/05/2016 08:20 PM, Titus Fortner wrote:
> Firefox is unlikely to ever support interacting with multiple tabs
> with Selenium

Is that also true of Chrome? Since I discovered Selenium I have been
working exclusively with Firefox, but if Chrome gave me the capability I
want I could switch.

Thanks, Jim

> On Sat, Nov 5, 2016 at 6:10 PM, Jim Byrnes
> <jf_b...@comcast.net> wrote:
>
>> I set up a Firefox profile to use with FirefoxProfile(). It has
>> open in tabs instead of windows checked. When I run my code
>> multiple windows still open and the option to open tabs is now
>> unchecked.
>>
>> I have found some old posts that say it is not possible to open
>> multiple tabs. I am checking to see if it is still impossible or
>> maybe I am doing something wrong in my code.
>>
>> Regards, Jim
>>
>> -- You received this message because you are subscribed to the
>> Google Groups "Selenium Users" group. To unsubscribe from this
>> group and stop receiving emails from it, send an email to
>> selenium-user...@googlegroups.com.
>>
>>
To post to this group, send email to
seleniu...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/ms
>> gid/selenium-users/nvlvts%24jdn%241%40blaine.gmane.org. For more
>> options, visit https://groups.google.com/d/optout.
>>
>


Krishnan Mahadevan

unread,
Nov 5, 2016, 10:17:02 PM11/5/16
to seleniu...@googlegroups.com

Opening a new page in a new tab vs new window is a behavior of the browser and NOT that of an application. So i would be curious to know as to why is "Open in a new window"NOT  good enough here ?

How is open in a new tab different from open in a new window in terms of the application functionality?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/




On Sun, Nov 6, 2016 at 7:28 AM +0530, "Jim Byrnes" <jf_b...@comcast.net> wrote:

On 11/05/2016 08:20 PM, Titus Fortner wrote:
> Firefox is unlikely to ever support interacting with multiple tabs
> with Selenium

Is that also true of Chrome?  Since I discovered Selenium I have been 
working exclusively with Firefox, but if Chrome gave me the capability I 
want I could switch.

Thanks,  Jim

> On Sat, Nov 5, 2016 at 6:10 PM, Jim Byrnes
>  wrote:
>
>> I set up a Firefox profile to use with FirefoxProfile(). It has
>> open in tabs instead of windows checked. When I run my code
>> multiple windows still open and the option to open tabs is now
>> unchecked.
>>
>> I have found some old posts that say it is not possible to open
>> multiple tabs. I am checking to see if it is still impossible or
>> maybe I am doing something wrong in my code.
>>
>> Regards, Jim
>>
>> -- You received this message because you are subscribed to the
>> Google Groups "Selenium Users" group. To unsubscribe from this
>> group and stop receiving emails from it, send an email to
>> selenium-user...@googlegroups.com.
>>
>>
To post to this group, send email to 
seleniu...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/ms
>> gid/selenium-users/nvlvts%24jdn%241%40blaine.gmane.org. For more
>> options, visit https://groups.google.com/d/optout.
>>
>


-- 
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com

Jim Byrnes

unread,
Nov 5, 2016, 11:11:24 PM11/5/16
to seleniu...@googlegroups.com
On 11/05/2016 09:16 PM, Krishnan Mahadevan wrote:
>
>
> Opening a new page in a new tab vs new window is a behavior of the
> browser and NOT that of an application. So i would be curious to know
> as to why is "Open in a new window"NOT good enough here ?
>
>
> How is open in a new tab different from open in a new window in terms
> of the application functionality?
>
>
> Thanks & Regards
>
> Krishnan Mahadevan

Because I am not using Selenium for testing. I want to use it to
automate some log ons, form filling, etc. I wanted to use it with an
existing instance of Firefox but learned here that it is not possible. I
am used to working with tabs not multiple open windows. So I thought if
I could use FirefoxProfile to open one window with multiple tabs that
would be ok. I had been using iMacros for this but for some reason a
couple of weeks ago it stopped working. An update or something must have
messed it up. At that point I discovered Selenium and the fact that it
had Python bindings seemed ideal.

Thanks, Jim

⇜Krishnan Mahadevan⇝

unread,
Nov 5, 2016, 11:17:50 PM11/5/16
to Selenium Users
Jim,

In that case, I would suggest that you please take a look at this StackOverFlow post and see if that helps


The solution is in java, but you should be able to translate it to Python as well..


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/
To post to this group, send email to
seleniu...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/ms
gid/selenium-users/nvlvts%24jdn%241%40blaine.gmane.org. For more
options, visit https://groups.google.com/d/optout.






--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.

To post to this group, send email to seleniu...@googlegroups.com.

Jim Byrnes

unread,
Nov 8, 2016, 8:10:15 PM11/8/16
to seleniu...@googlegroups.com
On 11/05/2016 10:17 PM, ⇜Krishnan Mahadevan⇝ wrote:
> Jim,
>
> In that case, I would suggest that you please take a look at this
> StackOverFlow post and see if that helps
>
> http://stackoverflow.com/questions/17547473/how-to-open-a-new-tab-using-selenium-webdriver-with-java
>
>
>
The solution is in java, but you should be able to translate it to
> Python as well..
>
>
> Thanks & Regards Krishnan Mahadevan
>

Krishnan,

Thanks for the link, that should help. Sorry for the delay in getting
back to you. A update totally messed up my video and I just got up and
running again.

Regards, Jim

Jim Byrnes

unread,
Nov 8, 2016, 9:05:58 PM11/8/16
to seleniu...@googlegroups.com
On 11/08/2016 07:08 PM, Jim Byrnes wrote:
> On 11/05/2016 10:17 PM, ⇜Krishnan Mahadevan⇝ wrote:
>> Jim,
>>
>> In that case, I would suggest that you please take a look at this
>> StackOverFlow post and see if that helps
>>
>> http://stackoverflow.com/questions/17547473/how-to-open-a-new-tab-using-selenium-webdriver-with-java
>>
>>
>>
>>
>
>>
The solution is in java, but you should be able to translate it to
>> Python as well..
>>
>>
>> Thanks & Regards Krishnan Mahadevan
>>
>
> Krishnan,
>
> Thanks for the link, that should help. Sorry for the delay in
> getting back to you. A update totally messed up my video and I just
> got up and running again.
>
> Regards, Jim

Krishnan,

A little below the java code was a Python version, but I could not get
it to work. Even further down was a javascript one liner that did work
until I tried to use it with a firefox profile I created for use with
Selenium. I have included some test code, does anyone see a way to make
it work.

#test_sel.py

from selenium import webdriver

'''
# This block doesn't work using a custom profile when running Selenium
fp =
webdriver.FirefoxProfile('/home/jfb/.mozilla/firefox/f8i6e3pi.Selenium')
fp.set_preference('browser.link.open_newwindow', 3)
driver = webdriver.Firefox(fp)
'''
# this block works. Opens a new browser window and then opens tabs in it
driver = webdriver.Firefox()

driver.get('http://mail.yahoo.com/?.intl=us')
# opens a new tab
driver.execute_script("window.open('http://stackoverflow.com/','_blank');");

goodl...@126.com

unread,
Nov 8, 2016, 9:10:24 PM11/8/16
to selenium-users
On 11/08/2016 07:08 PM, Jim Byrnes wrote:
> On 11/05/2016 10:17 PM, ⇜Krishnan Mahadevan⇝ wrote:
>> Jim,
>>
>> In that case, I would suggest that you please take a look at this
>> StackOverFlow post and see if that helps
>>
>>
>>
>>
>>
>
>>
The solution is in java, but you should be able to translate it to
>> Python as well..
>>
>>
>> Thanks & Regards Krishnan Mahadevan
>>
>
> Krishnan,
>
> Thanks for the link, that should help. Sorry for the delay in
> getting back to you.  A update totally messed up my video and I just
> got up and running again.
>
> Regards,  Jim
 
Krishnan,
 
A little below the java code was a Python version, but I could not get
it to work. Even further down was a javascript one liner that did work
until I tried to use it with a firefox profile I created for use with
Selenium. I have included some test code, does anyone see a way to make
it work.
 
#test_sel.py
 
from selenium import webdriver
 
'''
# This block doesn't work using a custom profile when running Selenium
fp =
webdriver.FirefoxProfile('/home/jfb/.mozilla/firefox/f8i6e3pi.Selenium')
fp.set_preference('browser.link.open_newwindow', 3)
driver = webdriver.Firefox(fp)
'''
# this block works. Opens a new browser window and then opens tabs in it
driver = webdriver.Firefox()
 
# opens a new tab
driver.execute_script("window.open('http://stackoverflow.com/','_blank');");
 
Regards,  Jim
 
>>
>> On Sun, Nov 6, 2016 at 8:40 AM, Jim Byrnes
>>
>>> On 11/05/2016 09:16 PM, Krishnan Mahadevan wrote:
>>>
>>>>
>>>>
>>>> Opening a new page in a new tab vs new window is a behavior of
>>>> the browser and NOT that of an application. So i would be
>>>> curious to know as to why is "Open in a new window"NOT  good
>>>> enough here ?
>>>>
>>>>
>>>> How is open in a new tab different from open in a new window
>>>> in terms of the application functionality?
>>>>
>>>>
>>>> Thanks & Regards
>>>>
>>>> Krishnan Mahadevan
>>>>
>>>
>>> Because I am not using Selenium for testing. I want to use it to
>>> automate some log ons, form filling, etc.  I wanted to use it
>>> with an existing instance of Firefox but learned here that it is
>>> not possible. I am used to working with tabs not multiple open
>>> windows. So I thought if I could use FirefoxProfile to open one
>>> window with multiple tabs that would be ok. I had been using
>>> iMacros for this but for some reason a couple of weeks ago it
>>> stopped working. An update or something must have messed it up.
>>> At that point I discovered Selenium and the fact that it had
>>> Python bindings seemed ideal.
>>>
>>> Thanks,  Jim
>>>
>>>
>
 
 
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages