简体   繁体   中英

pyCharm Selenium Python eol while scanning string

I have installed selenium and I can run it on Python. When I try and run int on pyCharm I keep getting the errors below. I believe it may have to do with how and where I installed pyCharm, but I can't seem to get it to work. I am looking for help on how I should be configuring pyCharm so I can run my automation script using Python, Selenium, ChromeDriver, and set it up to be triggered every 24 hours and 5 minutes. script: from selenium import webdriver from selenium.webdriver.common.keys import Keys

browser= webdriver.Chrome("D:/Projects/chromedriver.exe")
browser.get("https://url.com/")

formElem= browser.find_element_by_name('email')
formElem.send_keys('ucsb@gmail.com')

zipElem=browser.find_element_by_name('zipcode')

zipElem.send_keys('93101')

EnterNowElem=browser.find_element_by_xpath('//input[@value="Enter Now"]')

#EnterTagElem=browser.find_element_by_class_name("")
EnterNowElem.click()

I get the errors below.

"C:\Program Files (x86)\Python36-32\python.exe" 
C:/Users/rxper/Desktop/PycharmProjects/Automation/formsubmit.py
Traceback (most recent call last):
  File "C:/Users/rxper/Desktop/PycharmProjects/Automation/formsubmit.py", line 1, in <module>
   from selenium import webdriver

 File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\__init__.py", line 18, in <module>
   from .firefox.webdriver import WebDriver as Firefox  # noqa
File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 19, in <module>
   import http.client as http_client
File "C:\Program Files (x86)\Python36-32\lib\http\client.py", line 71, in <module>
   import email.parser
File "C:\Users\rxper\Desktop\PycharmProjects\Automation\email.py", line 31
'Subject: So long.\nDear Alice, so long and thanks for all the fish. Sincerely,

^
SyntaxError: EOL while scanning string literal

Process finished with exit code 1

You problem is below

File "C:\Users\rxper\Desktop\PycharmProjects\Automation\email.py"

and

File "C:\Program Files (x86)\Python36-32\lib\http\client.py", line 71, in <module>
   import email.parser

Python has a internal module email and your Automation\\email.py is overshadowing the same. Rename the file and it should work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM