使用量角器在Shadow-root中找到元素

时间:2019-02-02 16:19:06

标签: protractor shadow-dom

我的应用程序的大多数元素都在shadow-root(open)下。我需要使用量角器框架使它们自动化。 deepCSS没有解决。请帮助我自动化这些元素-大多是单击。

我必须使用量角器自动化框架单击阴影根元素。我尝试了deepCSS,xpath等。没有任何效果。

[HACK - decorators.py] Provided http_method_names: ['POST']
System check identified no issues (0 silenced).
[HACK - views.py] Method identified as advance_order
[HACK - views.py] list of http_method_names associated with the function: ['get', 'options']
{"detail":"Method \"POST\" not allowed."}
F
======================================================================
FAIL: test_advance_order (Wallet.tests.test_api_vendors.API_VendorTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/mnt/CommonShare/Code/DVM/APOGEE/Wallet/tests/test_api_vendors.py", line 231, in test_advance_order
    self.assertEqual(r.status_code, 400)
AssertionError: 405 != 400

----------------------------------------------------------------------
Ran 1 test in 0.377s

FAILED (failures=1)
Destroying test database for alias 'default'...

1 个答案:

答案 0 :(得分:0)

类似的问题:

似乎Shadow DOM尚未得到量角器的良好支持。第二个问题的答案指向此问题https://github.com/angular/protractor/issues/4367,还提供了添加自定义定位符by.addLocator('css_sr', (cssSelector: string, opt_parentElement, ....的解决方法。我确认这也适用于我。

相关问题