• 26-06-2023, 20:00:56
    #10
    msn560 adlı üyeden alıntı: mesajı görüntüle
    Chrome driver'in en güncel versiyonunu ilk açılışta indirip başlatmak için
     cmd > pip install webdriver-manager
    Kod örneği:
    from webdriver_manager.chrome import ChromeDriverManager
    from selenium.webdriver.chrome.service import Service
    from selenium import webdriver
    import os
    ROOT = os.path.dirname(os.path.abspath(__file__))
    profile ="default"
    profileDIR = ROOT  +"/"+profile  
    if not os.path.isdir(profileDIR):
                os.mkdir(profileDIR)
    Agent ="chrome user agent"
    service =  Service(ChromeDriverManager().install())  
    options = webdriver.ChromeOptions()
    options.add_experimental_option( "excludeSwitches", ["enable-automation"])
    options.add_experimental_option('useAutomationExtension', False)
    options.add_argument("start-maximized") //fullscreen başlatır
    options.add_argument('--no-sandbox')
    options.add_argument("--disable-blink-features")
    options.add_argument("--disable-blink-features=AutomationControlled")
    options.add_argument("--ignore-certificate-errors")
    options.add_argument('--profile-directory=default'.format(profile))
    options.add_argument('--user-data-dir={}'.format(profileDIR))
    options.add_argument(f'user-agent={Agent}') //agent
    options.add_experimental_option("detach", True) //otomatik olarak kapatmasını önlemek için kullanılır.
    driver = webdriver.Chrome(service=service  , options=options  )
    driver.get("http://example.com")
    Bu şekilde, ChromeDriverManager().install() ifadesi Chrome tarayıcısı için en son sürücüyü otomatik olarak indirip yükler. Bu sayede tarayıcı sürücüsünü ayrıca indirip yönetmekle uğraşmanız gerekmez.
    yeni dosya oluşturup test edebilirsiniz hocam ben bu şekilde kullanıyorum. Test sorunsuz geçerse projenize entegre edebilirsiniz.( proje yedeğeni alın, sonradan geri dönmesi kolay olsun)

    hocam desteginiz icin tesekkur ederim ama ben edge webdriver kullaniyorum
  • 27-06-2023, 16:19:13
    #11
    ChatGpt ile edge'ye dönüştürdüm masaüstünde test ettim hocam şuan sorunsuz çalışıyor.
    Kodlar:
    from webdriver_manager.microsoft import EdgeChromiumDriverManager
    from selenium.webdriver.edge.service import Service
    from selenium import webdriver
    import os
    ROOT = os.path.dirname(os.path.abspath(__file__))
    profile = "default"
    profileDIR = ROOT + "/" + profile
    if not os.path.isdir(profileDIR):
        os.mkdir(profileDIR)
    Agent = "edge user agent"
    service = Service(EdgeChromiumDriverManager().install())
    options = webdriver.EdgeOptions()
    options.add_experimental_option("excludeSwitches", ["enable-automation"])
    options.add_experimental_option("useAutomationExtension", False)
    options.add_argument("start-maximized")
    options.add_argument("--no-sandbox")
    options.add_argument("--disable-blink-features")
    options.add_argument("--disable-blink-features=AutomationControlled")
    options.add_argument("--ignore-certificate-errors")
    options.add_argument("--profile-directory=default".format(profile))
    options.add_argument("--user-data-dir={}".format(profileDIR))
    options.add_argument(f"user-agent={Agent}")
    options.add_experimental_option("detach", True)
    driver = webdriver.Edge(service=service, options=options)
    driver.get("http://google.com")
  • 29-06-2023, 11:12:11
    #12
    msn560 adlı üyeden alıntı: mesajı görüntüle
    ChatGpt ile edge'ye dönüştürdüm masaüstünde test ettim hocam şuan sorunsuz çalışıyor.
    Kodlar:
    from webdriver_manager.microsoft import EdgeChromiumDriverManager
    from selenium.webdriver.edge.service import Service
    from selenium import webdriver
    import os
    ROOT = os.path.dirname(os.path.abspath(__file__))
    profile = "default"
    profileDIR = ROOT + "/" + profile
    if not os.path.isdir(profileDIR):
        os.mkdir(profileDIR)
    Agent = "edge user agent"
    service = Service(EdgeChromiumDriverManager().install())
    options = webdriver.EdgeOptions()
    options.add_experimental_option("excludeSwitches", ["enable-automation"])
    options.add_experimental_option("useAutomationExtension", False)
    options.add_argument("start-maximized")
    options.add_argument("--no-sandbox")
    options.add_argument("--disable-blink-features")
    options.add_argument("--disable-blink-features=AutomationControlled")
    options.add_argument("--ignore-certificate-errors")
    options.add_argument("--profile-directory=default".format(profile))
    options.add_argument("--user-data-dir={}".format(profileDIR))
    options.add_argument(f"user-agent={Agent}")
    options.add_experimental_option("detach", True)
    driver = webdriver.Edge(service=service, options=options)
    driver.get("http://google.com")
    hocam hata aliyorum