栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

seleniumWeb驱动程序以其他用户身份运行而未获取用户的个人资料/会话

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

seleniumWeb驱动程序以其他用户身份运行而未获取用户的个人资料/会话

当前的Selenium.NET源不再需要此技术。

DriverProcessStarting
现在,该事件使用户可以修改
ProcessStartInfo
用于启动驱动程序服务过程的对象。完成此操作的代码如下所示:

假设您的用户对象看起来像这样:

public class User{    public string UserName { get; set; }    public SecureString Password { get; set; }    public string Domain { get; set; }    public bool LoadUserProfile { get; set; }}

您可以使用如下所示的内容:

public IWebDriver StartInternetExplorerDriver(InternetExplorerOptions options, User user){    InternetExplorerDriverService service = InternetExplorerDriverService.CreateDefaultService();    service.DriverProcessStarting += (object sender, DriverProcessStartingEventArgs e) =>    {        e.DriverServiceProcessStartInfo.UserName = user.UserName;        e.DriverServiceProcessStartInfo.Password = user.Password;        e.DriverServiceProcessStartInfo.Domain = user.Domain;        e.DriverServiceProcessStartInfo.LoadUserProfile = user.LoadUserProfile;    };    return new InternetExplorerDriver(service, options);}


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/380836.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号