Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In linux, is it possible to launch web browser with given window size and url using terminal console or some kind of script (e.g., shell)?

What I want to do is to test the web streaming server to see how many clients can video-stream from the server and manually launch firefox is quite annoying task.

Any comments would be appreciated.

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

Firefox supports command-line arguments to specify URL, height and width. For example:

firefox -height 600 -width 800 "example.com"

Depending on your setup, that might actually open in new tabs. Use -new-window "example.com" to force a new window.

Do note that these windows will actually launch under a single process, reusing one if FF is already open. Apparently, setting the size will not work unless you're starting a new process (see the comments). You must specify -no-remote in order to launch multiple independent processes, and each must use a different profile, which you can specify with -p "profilename". Profiles must be created before use.

For example, if you were to do this in a loop (bash):

for i in {1..10}
do
    firefox -no-remote -createprofile testprofile$i
    firefox -no-remote -p testprofile$i -height 600 -width 800 "example.com"&
done

(The & is at the end to run it in the backround, i.e. don't wait for it to close.)

share|improve this answer
    
Question is tagged Linux but yes dimension parameters work despite not being listed by firefox --help –  justbrowsing Aug 9 '13 at 8:28
    
@justbrowsing Yea, I just noticed I had .exe on the end. Force of habit. The rest should be applicable to Linux, AFAIK. –  Bob Aug 9 '13 at 8:28
    
I tried the following commands and the dimension param looks like not applied: firefox -height 300 -width 200 -new-window "google" –  jaeyong Aug 9 '13 at 8:49
    
also, adding -no-remote -createprofile "test1" to the argument does not work..., which setup am I missing? –  jaeyong Aug 9 '13 at 8:50
    
@jaeyong WorksForMe (Kubuntu, Firefox 23.0, what are you running?). You have to create profiles independently of using them; I'll amend the answer to include that. –  Bob Aug 9 '13 at 12:06
show 1 more comment

The question is unclear. Is this what you are asking?

firefox --no-remote -P testing http://my-url

  • You can just launch Firefox with firefox command
  • --no-remote tells it to launch a new instance
  • -P testing tells it to use a profile you named testing
  • URL opens instance with given URL

As far as the window size requirement, most Window Managers will remember the previous size of the window.

share|improve this answer
add comment

I can't advise on sizing the browser, but you can launch a firefox instance by simply typing

firefox "url"

From a command line.

So if you want to launch, for example, 10 instances you could write a 1 liner to launch multiple tabs to the same url :

for each in `seq 1 10`; do firefox ; done

I suspect that there are better ways of performance testing the site which don't require a browser, but I'm not an expert when it comes to streaming. WGET and CURL provide command line functionality for getting web pages and may provide a more objective result (I'm guessing you are not wanting to benchmark the browser, and a GUI has a much higher overhead)

share|improve this answer
    
Yes, I don't want to impose anykind of GUI overhead. But, still want to stress the server by video streaming. Any idea? –  jaeyong Aug 9 '13 at 8:43
    
You would need to advise how you are doing the streaming, or replace firefox with a command line stream capturing client. (Maybe VLC can help you by at least lowering the GUI overhead compared with a browser, or you could try, or use mencoder and copy the stream rather then convert it ?) –  davidgo Aug 9 '13 at 8:48
    
Oh, right. VLC or menucoder may help! thanks. I didn't think in that view :) –  jaeyong Aug 9 '13 at 8:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.