EXE makes hidden selenium console show

Viewed 45

I have some issues getting Selenium to work after being converted to an executable. The console keeps showing, even though I have hidden(or tried to at least) hide the console in the code.

Here's the code, if anyone can help, I'd appreciate it. Thanks! I am using auto-py-to-exe for this.

Here is a screenshot, maybe it helps. Colsole output

def WebFormEntry(firstName, lastName,Email, Msg1):
    WINDOW_SIZE = "1920,1080"
    webOptions = Options()
    webOptions.add_argument("--Headless")
    webOptions.add_experimental_option('excludeSwitches', ['enable-logging'])
    webOptions.add_argument("--log-level=3")
    webOptions.add_argument("--window-size=%s" % WINDOW_SIZE)
    web = webdriver.Chrome(executable_path='driver/chromedriver.exe', options = webOptions)
    web.get('*WEBSITE HERE*')
    firstElement = web.find_element_by_xpath('/html/body/div[1]/div[2]/div/div/main/div/article/div/div/form/div[1]/div[1]/div/div[1]/input')
    firstElement.send_keys(firstName)
    lastElement = web.find_element_by_xpath('//*[@id="wpforms-427-field_0-last"]')
    lastElement.send_keys(lastName)
    EmailElement = web.find_element_by_xpath('/html/body/div[1]/div[2]/div/div/main/div/article/div/div/form/div[1]/div[2]/input')
    EmailElement.send_keys(Email)
    msgElement = web.find_element_by_xpath('/html/body/div[1]/div[2]/div/div/main/div/article/div/div/form/div[1]/div[3]/textarea')
    msgElement.send_keys(Msg1)
    SubmitB = web.find_element_by_xpath('/html/body/div[1]/div[2]/div/div/main/div/article/div/div/form/div[2]/button')
    SubmitB.click()
    time.sleep(5)
    web.close()
1 Answers

Possibly a typo, but the argument instead of --Headless, should have been:

--headless
Related