selenium - 从会话 ID 获取主机名
问题描述
C# 代码我们的代码在 3 个节点上运行。我们有一个特殊要求,我们需要在脚本运行的运行时知道主机名。我已经得到了会话ID
string sessionId = ((RemoteWebDriver)this.Driver).SessionId.ToString();
已经尝试过以下方法。但是在阅读器中没有主机名参数
string url = "http://localhost:8080/grid/api/testsession?session=" + sessionId;
WebClient client = new WebClient();
Stream stream = client.OpenRead(url);
StreamReader reader = new StreamReader(stream);
我想从我已经收到的会话 id 中获取主机名
解决方案
推荐阅读
- python - Pandas 和 Matplotlib 缺失数据和绘图
- reactjs - 不渲染项目 React useState
- java - 我在将我的 Java 程序拆分为同一个类中的不同方法时遇到了问题,我可以就如何去做一些建议吗?
- c# - 如何将内容从 json 写入控制台?
- validation - 如何注释 Identity 用户的电子邮件属性?
- c++ - 尝试将 oracle DB 连接到 C++
- machine-learning - RL:使用 On-Policy 和 Off-Policy 进行自我游戏
- php - 使用 $_POST 将用户输入添加到 PHP 中的 JSON 数组会返回“null”数组
- python - 如何使用 Python 访问剑桥词典网站?
- python - 使用 pip 从 zip 安装 python 模块失败