我正在使用前端VueJS来设计我的网页和seleniumhub来测试我的前端。对于后端,我使用Django。所有这些都在我的码头上。
我在下面的URL中有多个名为WJLogin
、WJHeader
和WJFooter
的VueJS组件:“http://backend:8001/account/login”。除了VueJS的所有组件的元素外,该URL的所有元素都会加载。对于这个问题,我倾向于WJLogin
,因为如果一个组件确实加载了,那么其他组件也会自动加载(如果一切都相同)
我尝试了以下选项:
通过这个命令打印整个源代码print(driver.page_source)
这个结果表明WJLogin
没有被加载
重新启动整个docker
tests_frontend.py
class AccountTestCase(unittest.TestCase):
def setUp(self):
caps = {'browserName': 'chrome'}
url = 'http://selenium_hub:4444/wd/hub'
self.browser = webdriver.Remote(
command_executor=url,
desired_capabilities=caps
)
def tearDown(self):
self.browser.quit()
def test_login(self):
driver = self.browser
driver.get("http://backend:8001/account/login")
print(driver.page_source)
WJLogin.vue
(这是我的组件)<template>
<div>
<v-app>
<WJHeader :username="username"></WJHeader>
<v-layout align-center justify-center row>
<v-flex lg5>
<v-container white>
<form method="post" action="/login_view">
<h4>Login into <span class="primary--text"> Phoenix </span></h4>
<input name="csrfmiddlewaretoken" :value="csrf" type="hidden">
<v-text-field id="loginUsername" name="username" label="Username" required> </v-text-field>
<v-text-field
:append-icon="showPassword ? 'visibility' : 'visibility_off'"
:rules="[passwordRules.required]"
:type="showPassword ? 'text' : 'password'"
label="Password"
name="password"
id="loginPassword"
@click:append="showPassword = !showPassword">
</v-text-field>
<v-btn id="loginSubmit" color="success" type="submit"> Login </v-btn>
<v-btn color="error" type="reset"> Reset </v-btn>
</form>
</v-container>
</v-flex>
</v-layout>
<WJFooter></WJFooter>
</v-app>
</div>
</template>
(Ctrl+U)
(F12 -> inspector)
当我去我的网页没有硒,我可以看到WJLogin
没有问题
我希望Selenium必须加载WJLogin
组件,就像正常模式一样(没有Selenium和正常的chrome/firefox浏览器)
注意:在StackOverflow上发布图片需要10点声望
目前没有回答
相关问题 更多 >
编程相关推荐