瀏覽代碼

Fix checkout function to have y/n selection working and pull correct button text

Signed-off-by: Michael Tang <michaeltang@Michaels-MacBook-Pro.local>
Michael Tang 4 年之前
父節點
當前提交
e8e428d346
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      session.py

+ 5 - 5
session.py

@@ -96,21 +96,21 @@ def checkOut():
     except NoSuchElementException:
         print("no text area to enter")
     # Automated click of submit
-    submitButton =  driver.find_elements_by_xpath("//div[@class='uArJ5e UQuaGc Y5sE8d VkkpIf NqnGTe M9Bg4d']")
+    submitButton =  driver.find_elements_by_xpath("//div[@role='button']")
     # find the submit button 
-    # buttonText = submitButton[0].innerText
+    buttonText = submitButton[1].text
     pressSubmit = input("Press submit? (y/n)")
     if pressSubmit == "y":
-        #print(buttonText)
+        print(buttonText + " clicked!")
         submitButton[0].click()
         time.sleep(1)
         print("quitting")
         driver.quit()
     elif pressSubmit == "n":
-        print("Manual mode")
+        print("Manual mode engaged.")
         # find the back button
         backButton = driver.find_elements_by_xpath("//div[@role='button']")
-        #print(backButton[0].innerText)
+        print(backButton[0].text+ " clicked!")
         backButton[0].click()
     else:
         print("invalid key pressed.")