here is the code
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
brow=webdriver.Chrome(ChromeDriverManager().install())
brow.get("https://wuzzuf.net/search/jobs/?q=paython&a=hpb")
CodePudding user response:
So essentially, this is normal behavior--when you reach the end of your script the browser will close. Try the following and observe that the browser stays open as long as you tell it to.
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
import time
option = webdriver.ChromeOptions()
option.add_argument("start-maximized")
option.add_experimental_option("detach",True)
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()),options=option)
driver.get('https://wuzzuf.net/search/jobs/?q=paython&a=hpb')
time.sleep(5)
driver.find_element(By.CSS_SELECTOR, 'input[value="paython"]').send_keys("some stuff")
time.sleep(5)
Also, I'm not sure what syntax you used for detach
; the following works for me:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
import time
option = webdriver.ChromeOptions()
option.add_argument("start-maximized")
option.add_experimental_option("detach",True)
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()),options=option)
driver.get('https://wuzzuf.net/search/jobs/?q=paython&a=hpb')
CodePudding user response:
it actually worked by this way
from selenium import webdriver
from selenium.webdriver import chrome
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
options=webdriver.ChromeOptions()
options.add_experimental_option("detach",True)
driver=webdriver.Chrome(options=options,service=Service(ChromeDriverManager().install()))
driver.get("https://wuzzuf.net/search/jobs/?a=hpb|spbg&q=python")
driver.maximize_window()