error :รันโค้ด selenium test mooziicart

แนะนำ สอบถาม ภาษา C สำหรับผู้เริ่มต้น ภาษา Java ภาษา Python

Moderator: mindphp, ผู้ดูแลกระดาน

ภาพประจำตัวสมาชิก
chakirin.bfds
PHP Super Hero Member
PHP Super Hero Member
โพสต์: 783
ลงทะเบียนเมื่อ: 22/12/2020 10:19 am

error :รันโค้ด selenium test mooziicart

โพสต์ที่ยังไม่ได้อ่าน โดย chakirin.bfds »

รันโค้ด selenium สำหรับ ทดสอบ MooZiiCart ผ่าน command เเล้วเกิด error ตามภาพนี้ครับ
Selection_040.png
ไม่ทราบว่าผิดพลาดอะไร ต้องแก้ไขตรงไหน ช่วยไกด์ให้หน่อยครับ
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41344
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Re: error :รันโค้ด selenium test mooziicart

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

ขอ ข้อความ Error ด้วยครับ
เว็บบอร์ด จะช่วยไกด์ กระทู้เก่าๆ ให้
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ภาพประจำตัวสมาชิก
chakirin.bfds
PHP Super Hero Member
PHP Super Hero Member
โพสต์: 783
ลงทะเบียนเมื่อ: 22/12/2020 10:19 am

Re: error :รันโค้ด selenium test mooziicart

โพสต์ที่ยังไม่ได้อ่าน โดย chakirin.bfds »

ข้อความ error code ครับ


line 76
Selection_043.png
Selection_043.png (6.51 KiB) Viewed 1614 times
line 947
Selection_045.png
line 1551
Selection_046.png
Selection_046.png (17.31 KiB) Viewed 1614 times
line 315
Selection_047.png
Selection_047.png (10.24 KiB) Viewed 1614 times
line 164
Selection_049.png
Selection_049.png (7.34 KiB) Viewed 1614 times
แก้ไขล่าสุดโดย chakirin.bfds เมื่อ 29/12/2020 2:33 pm, แก้ไขไปแล้ว 1 ครั้ง.
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41344
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Re: error :รันโค้ด selenium test mooziicart

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

ขอ เป็นข้อความมาแปะ กระทู้เลยครับ และ ปิดข้อความ ส่วนตัว เช่น user, email, password ออก ด้วยครับ
โค้ดไม่ต้อง cap ภาพมาแปะ


*** copy code
*** ข้อความ Error มาแปะ ในบอร์ด
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ภาพประจำตัวสมาชิก
chakirin.bfds
PHP Super Hero Member
PHP Super Hero Member
โพสต์: 783
ลงทะเบียนเมื่อ: 22/12/2020 10:19 am

Re: error :รันโค้ด selenium test mooziicart

โพสต์ที่ยังไม่ได้อ่าน โดย chakirin.bfds »

โค้ดที่ผมคิดว่าจะมีปัญหาคือ
Error line 76

โค้ด: เลือกทั้งหมด

'Orders'
value_order = 2
status_order = 'Cancelled' #Cancelled , Paid  


Error line 947

โค้ด: เลือกทั้งหมด

            for i in range(10):
                try:
                    if self.driver.find_element_by_css_selector('.row0:nth-child(%d) > td:nth-child(%d) > a' % ( n, td)):
                        ojb = self.driver.find_element_by_css_selector('.row0:nth-child(%d) > td:nth-child(%d) > a' % (n, td))
                        msg = ojb.text
                        self.msg1 = msg  # .row0:nth-child(3) > td:nth-child(3) > a
                        break
                except:
                    pass
                print(i)
                time.sleep(1)
               

Error line 1551

โค้ด: เลือกทั้งหมด

  for i in range(4):
                try:
                    if self.driver.find_element_by_link_text("Description (en)"):
                        self.report_error()
                except:
                    pass
            else:
                print('check pass1')
            for i in range(4):
                try:
                    if self.driver.find_element_by_link_text("Description (th)"):
                        self.report_error()
                except:
                    pass
            else:
                print('check pass2')
            self.find_css(Cancel)
Error line 315

โค้ด: เลือกทั้งหมด

  def setUp(self):
        self.driver = webdriver.Firefox(executable_path=path)  # __builtin__.firefoxpath)
        self.base_url = wed0  # __builtin__.base_url #=
        self.base_url1 = wed1  # __builtin__.base_url1 #=
        self.username = user  # __builtin__.username #=
        self.username1 = user1  # __builtin__.username1 #=
        self.username2 = user2  # __builtin__.username1 #=
        self.pwd = password  # __builtin__.pwd #=
        self.pwd1 = password1  # __builtin__.pwd1 #=
        self.pwd2 = password2  # __builtin__.pwd1 #=
        self.verificationErrors = []
        self.accept_next_alert = True
        self.wait = WebDriverWait(self.driver, 10)
        self.Case = Case
Error line 164

โค้ด: เลือกทั้งหมด

'Delivery time'
Title_en = 'test003'
Title_en1 = 'test033'
Title_th = 'test003'
Days = '30'
Days1 = '15'
Delivery_timefile_edit = 'test003'
Error line 83

โค้ด: เลือกทั้งหมด

'Clients'
ClientsUsername = '000000'
ClientsUsername1 = '000000'
ClientsEmail = '[email protected]'
ClientsEmail1 = '[email protected]'
ClientsPassword = '000000'
ClientsPassword1 = '000000'
ClientsUsergroup = '0000'
Clientsfile_edit = '00000'

error ที่เเจ้งเตือน

โค้ด: เลือกทั้งหมด

/home/com003/PycharmProjects/pythonProject1/venv/bin/python /home/com003/Downloads/r-selenium-test-mooziicart-master/selenium_moozii_T2.py
E
======================================================================
ERROR: test00 (__main__.test01_check)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/com003/PycharmProjects/pythonProject1/venv/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 76, in start
    stdin=PIPE)
  File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver.exe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/com003/Downloads/r-selenium-test-mooziicart-master/selenium_moozii_T2.py", line 315, in setUp
    self.driver = webdriver.Firefox(executable_path=path)  # __builtin__.firefoxpath)
  File "/home/com003/PycharmProjects/pythonProject1/venv/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__
    self.service.start()
  File "/home/com003/PycharmProjects/pythonProject1/venv/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 83, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver.exe' executable needs to be in PATH. 


----------------------------------------------------------------------
Ran 1 test in 0.008s

FAILED (errors=1)

Process finished with exit code 1
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41344
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Re: error :รันโค้ด selenium test mooziicart

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

จากที่ Error นี้
/home/com003/PycharmProjects/pythonProject1/venv/bin/python /home/com003/Downloads/r-selenium-test-mooziicart-master/selenium_moozii_T2.py
E
======================================================================
ERROR: test00 (__main__.test01_check)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/com003/PycharmProjects/pythonProject1/venv/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'geckodriver.exe'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/com003/Downloads/r-selenium-test-mooziicart-master/selenium_moozii_T2.py", line 315, in setUp
self.driver = webdriver.Firefox(executable_path=path) # __builtin__.firefoxpath)
File "/home/com003/PycharmProjects/pythonProject1/venv/lib/python3.5/site-packages/selenium/webdriver/firefox/webdriver.py", line 164, in __init__
self.service.start()
File "/home/com003/PycharmProjects/pythonProject1/venv/lib/python3.5/site-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver.exe' executable needs to be in PATH.


----------------------------------------------------------------------
Ran 1 test in 0.008s

FAILED (errors=1)

Process finished with exit code 1
ระบบ แจ้งว่า WebDriverException
ในเครื่องเรา ไม่มี geckodriver.exe
ถ้าใช้ Ubuntu กำหนด path นี้ใหม่ โดยโหลด geckodriver จากที่นี่
https://github.com/mozilla/geckodriver/releases
แล้วแก้ไข โค้ดส่วนที่เรียก หาไฟล์ geckodriver.exe เป็นไฟล์ geckodriver ตัวใหม่สำหรับ Ubuntu ที่โหลดมา
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ภาพประจำตัวสมาชิก
mindphp
ผู้ดูแลระบบ MindPHP
ผู้ดูแลระบบ MindPHP
โพสต์: 41344
ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
ติดต่อ:

Re: error :รันโค้ด selenium test mooziicart

โพสต์ที่ยังไม่ได้อ่าน โดย mindphp »

ปัญหา เดียวกับกระทู้นี้
viewtopic.php?f=298&t=69900&p=198529
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ภาพประจำตัวสมาชิก
chakirin.bfds
PHP Super Hero Member
PHP Super Hero Member
โพสต์: 783
ลงทะเบียนเมื่อ: 22/12/2020 10:19 am

Re: error :รันโค้ด selenium test mooziicart

โพสต์ที่ยังไม่ได้อ่าน โดย chakirin.bfds »

เรียบร้อยเเล้วครับ
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 68