我尝试在Windows 10系统上使用Selenium Webdriver和Python来实现浏览器操作的自动化.但是我有这个问题:Selenium启动的Firefox窗口没有"看到"我已经登录并且目标站点将我发送到登录页面.所以我认为Selenium并没有真正使用配置文件,只是它的副本.
我想知道:
编辑:
from selenium import webdriver
fp = webdriver.FirefoxProfile('C:/Users/<user name>/AppData/Roaming/Mozilla/Firefox/Profiles/abc3defghij2.ProfileName')
driver = webdriver.Firefox(fp)
driver.get("https://www.example.com/membersarea")
Run Code Online (Sandbox Code Playgroud) 我在 config.yml 中有:
parameters:
aaa:
bbb: 'Example'
Run Code Online (Sandbox Code Playgroud)
如果我在服务中通过了这个:
AppBundle\Service\Service:
arguments:
$bbb: '%aaa%'
Run Code Online (Sandbox Code Playgroud)
然后这运行良好,我有数组,但如果我通过:
AppBundle\Service\Service:
arguments:
$bbb: '%aaa.bbb%'
Run Code Online (Sandbox Code Playgroud)
然后我有错误:
服务“AppBundle\Service\Service”依赖于不存在的参数“aaa.bbb”。您无法访问嵌套数组项,是否要注入“aaa”?
可以只传递一个值吗?
我在symfony 2.6中按名称进行了服务设置,ge_lib如下所示
ge_lib:
class: GE\RestBundle\Services\GELib
arguments: [@session, @doctrine.orm.entity_manager, @manage_ge_proc]
Run Code Online (Sandbox Code Playgroud)
在GELib.php中我需要使用来自其他服务的函数 manage_ge_proc
manage_ge_proc:
class: GE\RestBundle\Services\GEManageProcedure
arguments: [@doctrine.orm.entity_manager, @manage_ge_native_query]
Run Code Online (Sandbox Code Playgroud)
如果我尝试以这种方式使用它,它就不起作用了
$emailInv = $this->get('manage_ge_proc');
$sendStatus = $emailInv->pSendGeneralEmail(.....);
Run Code Online (Sandbox Code Playgroud)
它给出错误,说无法通过该名称找到任何get函数.通常这 - > $this->get('manage_ge_proc');在任何控制器中工作.但我如何在服务中使用它?
我试过$this->getContainer()->get('manage_ge_proc');但它没用.