I want to make exe using py file which is attached. Some test py files was formed exe and worked well.(using pyinstaller)
But I don't know why attached py file do not be converted the EXE file.
So, please try convert exe file and give me a feedback which point is wrong.
(This file is do not work in your computer due to coporate site. And this is py file for automation on the web browser.)
Creating py file using PYCHARM / Making exe file using pyinstaller on the Anaconda Powershell Prompt (Anaconda3)
** I want to show you prompt error which you can see simply. But I don't know which is error is critical to make exe. So, I attach the full prompt mssgs. Thank you for your understanding.
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
#from selenium.webdriver.common.action_chains import ActionChains
import time
from openpyxl import load_workbook
#from pywinauto.application import Application
#import win32com.client
import os.path
driver = webdriver.Chrome('C:/Temp/chromedriver')
driver.get('https://s1-eu.ariba.com/gb/toapprove/todos?realm=FAURECIASERVICESGROUPE&realm=FAURECIASERVICESGROUPE&locale=ko')
WB = load_workbook('C:\Temp\ARIBA_PR.xlsx',data_only=True)
WS = WB['Sheet1']
Number_of_total_data = WS.cell(1,1).value
R_Number_of_total_data = range(Number_of_total_data)
print(Number_of_total_data)
print(R_Number_of_total_data)
driver.implicitly_wait(300)
for i in (R_Number_of_total_data) :
i += 1
WebDriverWait(driver, 100).until(expected_conditions.visibility_of_element_located((By.CSS_SELECTOR, '#fd-shellbar__logo')))
driver.find_element_by_css_selector('#fd-shellbar__logo').click()
WebDriverWait(driver, 100).until(expected_conditions.visibility_of_element_located((By.CSS_SELECTOR, '#gbsection > div.row > aside > div > div.non-quick-link-panel > div:nth-child(1) > div > a')))
driver.find_element_by_css_selector('#gbsection > div.row > aside > div > div.non-quick-link-panel > div:nth-child(1) > div > a').click()
WebDriverWait(driver, 100).until(expected_conditions.visibility_of_element_located((By.XPATH, '//*[@id="gbsection"]/adhoc-checkout-form-new/main/gb-action-bar/div/div/div/div[2]/div[1]/div[2]/div/button[1]')))
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/adhoc-checkout-form-new/main/div/div[1]/div[2]/div/div[1]/div[1]/div/field/div/div[1]/div/ng-include/input').send_keys(WS.cell(i+2,1).value)
time.sleep(1)
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/adhoc-checkout-form-new/main/div/div[1]/div[2]/div/div[1]/div[2]/div/field/div/div[1]/div/ng-include/div[1]/button').click()
time.sleep(1)
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/adhoc-checkout-form-new/main/div/div[1]/div[2]/div/div[1]/div[2]/div/field/div/div[1]/div/ng-include/div[1]/ul/li[13]/div/a').click()
time.sleep(1)
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/adhoc-checkout-form-new/main/div/div[1]/div[2]/div/div[1]/div[2]/div/field/div/div[1]/div/ng-include/div[2]/div/div/div/div/div[2]/form/div/input').send_keys(WS.cell(i+2,2).value, Keys.ENTER)
time.sleep(1)
driver.find_element_by_css_selector('#tree-root > ol > li > ol > li > ol > li > ol > li > table > tbody > tr > td.choose-button > button').click()
time.sleep(1)
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/adhoc-checkout-form-new/main/div/div[1]/div[2]/div/div[2]/div[1]/div/div/div/field/div/div[1]/div/ng-include/div/textarea').send_keys(WS.cell(i+2,3).value)
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/adhoc-checkout-form-new/main/div/div[1]/div[2]/div/div[2]/div[2]/div/ul/li[1]/field/div/div[1]/div/ng-include/div/div/input').send_keys(WS.cell(i+2,4).value)
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/adhoc-checkout-form-new/main/div/div[1]/div[2]/div/div[2]/div[2]/div/ul/li[3]/field/div/div[1]/div/ng-include/div/input').send_keys(WS.cell(i+2,5).value)
driver.find_element_by_css_selector('#gbsection > adhoc-checkout-form-new > main > gb-action-bar > div > div > div > div.fd-action-bar__header > div.req-title.gb-action-title > div.fd-action-bar__actions > div > button.btn-medium.pull-right.btn-primary').click()
WebDriverWait(driver, 300).until(expected_conditions.invisibility_of_element((By.XPATH, '/html/body/span[1]')))
#WebDriverWait(driver, 300).until(expected_conditions.visibility_of_element_located((By.XPATH, '//*[@id="shopping-cart-submit-button"]')))
driver.find_element_by_css_selector('#shopping-cart-submit-button').click()
WebDriverWait(driver, 300).until(expected_conditions.visibility_of_element_located((By.XPATH, '//*[@id="gbsection"]/div[1]/gb-action-bar/div/div/div/div[2]/div[1]/div[2]/div/button[2]')))
driver.find_element_by_css_selector('#NeedBy > div.form-group.error > div > ng-include > div > input').send_keys(WS.cell(i+2,6).value)
WebDriverWait(driver, 300).until(expected_conditions.invisibility_of_element((By.XPATH, '/html/body/span[1]')))
driver.find_element_by_css_selector('#cus_ControllerField > div.form-group.error > div > ng-include > div.field-chooser.dropdown > button').click()
driver.find_element_by_css_selector('#cus_ControllerField > div.form-group.error > div > ng-include > div.field-chooser.dropdown.open > ul > li:nth-child(2) > a').click()
WebDriverWait(driver, 300).until(expected_conditions.invisibility_of_element((By.XPATH, '/html/body/span[1]')))
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/div[3]/div[3]/div/div[1]/line-item-new/div[1]/div[3]/div[1]/div/div[2]/field/div/div[1]/div/ng-include/div[1]/button').click()
WebDriverWait(driver, 300).until(expected_conditions.invisibility_of_element((By.XPATH, '/html/body/span[1]')))
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/div[3]/div[3]/div/div[1]/line-item-new/div[1]/div[3]/div[1]/div/div[2]/field/div/div[1]/div/ng-include/div[1]/ul/li[13]/div/a').click()
WebDriverWait(driver, 300).until(expected_conditions.invisibility_of_element((By.XPATH, '/html/body/span[1]')))
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/div[3]/div[3]/div/div[1]/line-item-new/div[1]/div[3]/div[1]/div/div[2]/field/div/div[1]/div/ng-include/div[2]/supplier-chooser-modal/div/div/div/div/div[2]/form/div/input').send_keys(WS.cell(i+2,7).value, Keys.ENTER)
WebDriverWait(driver, 300).until(expected_conditions.invisibility_of_element((By.XPATH, '/html/body/span[1]')))
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/div[3]/div[3]/div/div[1]/line-item-new/div[1]/div[3]/div[1]/div/div[2]/field/div/div[1]/div/ng-include/div[2]/supplier-chooser-modal/div/div/div/div/div[2]/div/table/tbody/tr[2]/td[7]/button').click()
WebDriverWait(driver, 300).until(expected_conditions.invisibility_of_element((By.XPATH, '/html/body/span[1]')))
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/div[3]/div[3]/div/div[1]/line-item-new/div[1]/div[3]/div[2]/div/field[5]/div/div[1]/div/ng-include/div[1]/button').click()
WebDriverWait(driver, 300).until(expected_conditions.invisibility_of_element((By.XPATH, '/html/body/span[1]')))
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/div[3]/div[3]/div/div[1]/line-item-new/div[1]/div[3]/div[2]/div/field[5]/div/div[1]/div/ng-include/div[1]/ul/li[5]/div/a').click()
WebDriverWait(driver, 300).until(expected_conditions.invisibility_of_element((By.XPATH, '/html/body/span[1]')))
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/div[3]/div[3]/div/div[1]/line-item-new/div[1]/div[3]/div[2]/div/field[5]/div/div[1]/div/ng-include/div[2]/div/div/div/div/div[2]/div/div[1]/form/div[2]/input').send_keys(WS.cell(i+2,8).value, Keys.ENTER)
WebDriverWait(driver, 300).until(expected_conditions.invisibility_of_element((By.XPATH, '/html/body/span[1]')))
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/div[3]/div[3]/div/div[1]/line-item-new/div[1]/div[3]/div[2]/div/field[5]/div/div[1]/div/ng-include/div[2]/div/div/div/div/div[2]/div/div[2]/div[2]/table/tbody/tr[2]/td[3]/button').click()
WebDriverWait(driver, 300).until(expected_conditions.invisibility_of_element((By.XPATH, '/html/body/span[1]')))
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/div[4]/gb-comment/div/div[2]/div/div/div/div[1]/textarea').send_keys(WS.cell(i+2,3).value)
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/div[4]/gb-comment/div/div[2]/div/div[1]/div/div[2]/button').click()
for(path,dir,files) in os.walk("\\\\kryngfls0002.ls.ege.ds\share\Testing\T02_Test_report\T02.16_Test report_2021"):
for filename in files:
if filename == WS.cell(i+2,9).value:
Report_path = path+'\\'+filename
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/div[4]/gb-attachment/div/div[2]/div/div/div/div[1]/div[1]/div[1]/label/input').send_keys(Report_path)
WebDriverWait(driver, 100).until(expected_conditions.visibility_of_element_located((By.XPATH, '/html/body/div[1]/app-root/div[3]/ui-view/section/div[4]/gb-attachment/div/div[2]/div/div/div/div[1]/div[1]/div[2]/span/i')))
driver.find_element_by_xpath('/html/body/div[1]/app-root/div[3]/ui-view/section/div[4]/gb-attachment/div/div[2]/div/div/div/div[2]/button').click()
WebDriverWait(driver, 300).until(expected_conditions.invisibility_of_element((By.XPATH, '/html/body/span[1]')))
driver.find_element_by_xpath('/htmls/body/div[1]/app-root/div[3]/ui-view/section/div[1]/gb-action-bar/div/div/div/div[2]/div[1]/div[2]/div/button[1]').click()
I choose suspected error.
ImportError: DLL load failed while importing _win32sysloader: %1 is not a valid Win32 application.
ImportError: DLL load failed while importing _win32sysloader: %1 is not a valid Win32 application.
519014 INFO: Excluding import of gevent.testing.errorhandler from module gevent
519023 INFO: Excluding import of gevent.testing.errorhandler from module gevent.testing
519055 INFO: Excluding import of gevent.testing.errorhandler from module gevent.testing.testcase
519062 INFO: Excluding import of gevent.testing from module gevent.testing.errorhandler
519118 INFO: Excluding import of gevent.testing.sysinfo from module gevent.tests.test__socket_errors
519118 INFO: Excluding import of gevent.testing.support from module gevent.tests.test__socket_errors
519157 INFO: Excluding import of gevent.testing from module gevent.tests.test__systemerror
519253 INFO: Excluding import of gevent.tests.test__socket_errors from module gevent
519279 INFO: Excluding import of gevent.tests.test__systemerror from module gevent
519368 INFO: Excluding import of gevent.tests from module gevent.tests.test__socket_errors
519391 INFO: Excluding import of gevent.tests from module gevent.tests.test__systemerror
608703 WARNING: Reason: 'DOS Header magic not found.'
Traceback (most recent call last):
File "C:\Users\ahnsangh\AppData\Roaming\Python\Python38\site-packages\win32ctypes\pywin32\pywintypes.py", line 35, in pywin32error
yield
File "C:\Users\ahnsangh\AppData\Roaming\Python\Python38\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx
return _dll._LoadLibraryEx(fileName, 0, flags)
File "C:\Users\ahnsangh\AppData\Roaming\Python\Python38\site-packages\win32ctypes\core\cffi\_dll.py", line 23, in _LoadLibraryEx
result = check_null(
File "C:\Users\ahnsangh\AppData\Roaming\Python\Python38\site-packages\win32ctypes\core\cffi\_util.py", line 81, in __call__
self._raise_error(function_name)
File "C:\Users\ahnsangh\AppData\Roaming\Python\Python38\site-packages\win32ctypes\core\cffi\_util.py", line 92, in _raise_error
raise exception
OSError: [WinError 2] The system cannot find the file specified
I have PyInstaller: 3.5 and Python: 3.7.4.
I created a test.py file with the source you have provided.
Then in cmd line I used command "pyinstaller test.py"
The exe and related files are created in dist folder.