Python Forum

Full Version: Chromedriver launch new tab
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
The way you have it coded in your first post you are creating separate processes for every time you hit a button. So for example you keep hitting yahoo and it creates an entire different browser every time. You are going to want to unite them. The best way to do that is a class. This driver = webdriver.Chrome(executable_path=r'chromedriver.exe') being in every function creates a new driver process every time.
(Feb-16-2019, 01:39 PM)metulburr Wrote: [ -> ]The way you have it coded in your first post you are creating separate processes for every time you hit a button. So for example you keep hitting yahoo and it creates an entire different browser every time. You are going to want to unite them. The best way to do that is a class. This driver = webdriver.Chrome(executable_path=r'chromedriver.exe') being in every function creates a new driver process every time.

Any sample code to achieve this?
I apologies that I am new to python. :x

EDIT:

Now I had follow your advised. I combined them into 1 python script file.
And execute them via CMD function by function like

>> python
>> import sample
>> sample.google
>> sample.baidu
>> sample.yahoo
So these will import the python script and execute function by function, each function will open in new tab and redirect to desire URL.
But somehow, I am finding solution for my another software that designed the GUI, on how to send multiple line of command without open new CMD.
Anyway, I wanna ask if the python script has convert to executable file (sample.py >> sample.exe)
It is possible to execute the sample.exe function by function via CMD, like the CMD shown above?
If can't, then is there anyway to protect my python script similar like executable file?
Thanks.
Anyway, I have the solution for the software to send line by line to CMD window to trigger particular functions.
Now final concern is
Quote:Anyway, I wanna ask if the python script has convert to executable file (sample.py >> sample.exe)
It is possible to execute the sample.exe function by function via CMD, like the CMD shown above?
If can't, then is there anyway to protect my python script similar like executable file?
you can build your python scripts to exe also
https://python-forum.io/Thread-Building-...ith-Py2exe
(Feb-17-2019, 12:04 AM)metulburr Wrote: [ -> ]you can build your python scripts to exe also
https://python-forum.io/Thread-Building-...ith-Py2exe

I had tried to convert the script to executable file, but it just unable to execute the .exe file.
I had post in the forum but no one response.
Fail to execute .exe file
thats a separate issue then, not really related to issues with chromedriver (the title of this thread)
Pages: 1 2