Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在For循环中执行seleniumpython代码_Python_Selenium_Selenium Webdriver - Fatal编程技术网

在For循环中执行seleniumpython代码

在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

我有一个脚本调用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("/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")