Hack Forums
[Python] Chrome window control - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] Chrome window control (/showthread.php?tid=5878746)



Chrome window control - PHaRTnONuAlL - Aug 27, 2018

So im having a issue im new to py so bear with me i dont know nearly enough sytax's here.

So im trying to window & tab control i was using java but chrome blocks being able to tab control them with java so that wont work.
End game is opening 4-5 different windows with each having about 3-5 tabs in each.
Each window is sized and positioned accordingly (preferably from a readline with such data
Quote:Chrome=C:\Chrome.exe
"http://www.twitter.com","Window1","width=350,height=250,left=700,top=700"
"http://www.facebook.com",Window1"

"http://www.twitter.com","Window2","width=350,height=250,left=250,top=250"
"http://www.facebook.com",Window2"



or something close to it

while diving in to py ive noticed it does not creat a call handle for the window so how do i control it to manipulate or add tabs?
webbrowser
webbrowser.open
allows me to open a new tab but no where can i designate the call handle for the window? how can i resize and position it and designate which window is getting which tab. (mind you i do not have selenium)

any help would be appreciated thanks


RE: Chrome window control - .kr. - Aug 28, 2018

look at this. it should help to write your own script

Code
import subprocess
import sys

def main(argc, argv):
    windows = [
        ("www.google.com", "twitter.com"),
        ("facebook.com", "youtube.com")
    ]
    for links in windows:
        attach = ""
        for link in links:
            attach+= ' "' + link + '"'
        cmd = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --new-window ' + attach
        subprocess.call(cmd)
    sys.exit(0)

if __name__ == '__main__':
    try:
        main(len(sys.argv), sys.argv)
    except KeyboardInterrupt:
        pass



RE: Chrome window control - PHaRTnONuAlL - Aug 28, 2018

(Aug 28, 2018 01:42 AM).kr. Wrote:  look at this. it should help to write your own script

Code
import subprocess
import sys

def main(argc, argv):
   windows = [
       ("www.google.com", "twitter.com"),
       ("facebook.com", "youtube.com")
   ]
   for links in windows:
       attach = ""
       for link in links:
           attach+= ' "' + link + '"'
       cmd = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --new-window ' + attach
       subprocess.call(cmd)
   sys.exit(0)

if __name__ == '__main__':
   try:
       main(len(sys.argv), sys.argv)
   except KeyboardInterrupt:
       pass
🤗 🎉 👍
thanks, got it done