Receiving the Chrome API (chrome.runtime) within Selenium test

丶灬走出姿态 提交于 2019-12-13 06:45:45

问题


I successfully got Selenium tests to work with my Chrome extension. But still I have an issue where the ID of the extension should be received through the Chrome API.

Why do I need that? Since the project is within Git I want to ensure that my code buddy can run the tests without configuring much. Everything works fine BUT the ID for the extension differs from every machine.

My ID is:

chrome-extension://dafanlbggefkfnbekjceijjhgcancpik/html/options.html

What do I need? To receive this ID dynamically I need access to chrome.runtime.id. Which is not trivial since the Chrome API is not accessible for me within my Selenium test code.

var extensionID = chrome.runtime.id;
var urlToOptionsPage = 'chrome-extension://'+ extensionID +'/html/options.html';

That's what I actually want to achieve so my Selenium tests can open the proper locale extension URL.

Does anybody have a clue what I need to do within the manifest.json or within Selenium configs or another workaround?

来源:https://stackoverflow.com/questions/36641833/receiving-the-chrome-api-chrome-runtime-within-selenium-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!