在For循环中执行seleniumpython代码
我有一个脚本调用create_cpe.py 它打开firefox并创建一个cpe在For循环中执行seleniumpython代码,python,selenium,selenium-webdriver,Python,Selenium,Selenium Webdriver,我有一个脚本调用create_cpe.py 它打开firefox并创建一个cpe 创建_cpe.py 当我运行python create\u cpe.py 现在 我要把它带到下一个层次。 我正在尝试创建一个for循环并运行相同的脚本 import os cpe = raw_input("How many CPE you want to create ? : ") for x in xrange(int(cpe)): os.system("/Applica
创建_cpe.py 当我运行
python create\u cpe.py
现在 我要把它带到下一个层次。 我正在尝试创建一个for循环并运行相同的脚本
import os
cpe = raw_input("How many CPE you want to create ? : ")
for x in xrange(int(cpe)):
os.system("/Applications/MAMP/htdocs/code/python/create_cpe.py")
print cpe + ' new CPE(s) inserted !'
我得到了
from: can't read /var/mail/selenium
from: can't read /var/mail/selenium.webdriver.common.by
from: can't read /var/mail/selenium.webdriver.common.keys
from: can't read /var/mail/selenium.webdriver.support.ui
from: can't read /var/mail/selenium.common.exceptions
from: can't read /var/mail/selenium.common.exceptions
/Applications/MAMP/htdocs/code/python/create_cpe.py: line 8: import: command not found
/Applications/MAMP/htdocs/code/python/create_cpe.py: line 9: import: command not found
/Applications/MAMP/htdocs/code/python/create_cpe.py: line 10: import: command not found
/Applications/MAMP/htdocs/code/python/create_cpe.py: line 12: syntax error near unexpected token `('
/Applications/MAMP/htdocs/code/python/create_cpe.py: line 12: `class CreateCPE(unittest.TestCase):'
我错过什么了吗 我要不要试试别的
为什么在我使用for循环执行它时它不工作?os.system运行它就像运行bash脚本一样。运行它的线路应该是
os.system("python /Applications/MAMP/htdocs/code/python/create_cpe.py")
系统正在运行它,就像它是一个bash脚本一样。运行它的线路应该是
os.system("python /Applications/MAMP/htdocs/code/python/create_cpe.py")