在C#中使用硒设置chrome设置 [英] set chrome settings using selenium in C#

查看:130
本文介绍了在C#中使用硒设置chrome设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图改变一些Chrome设置,例如,在设置 - >下载中标记:询问在下载之前将每个文件保存在何处作为检查。



问题是,当我试图用硒做这件事时,它找不到我提供的xPath,
但是当我自己尝试这个xPath时,它找到了合适的地方(右边的复选框来标记)。所以我的问题,甚至有可能吗?如果是的话,怎么样?

谢谢!

编辑:



我注意到的另一个问题是,在安装完chrome之后,在第一次使用之前,它尚未存在于chrome settings目录中:C:\ Users \ %% \\ \\ AppData \Local\Google\Chrome\User Data\任何默认配置文件。只有在第一次使用后才显示。我的问题是从哪里来的这个默认配置文件?我想在首次使用前配置它。

解决方案

如果您设置浏览器配置文件


I'm trying to change some chrome setting, for example, mark in settings->downloads :"Ask where to save each file before downloading" as "Checked".

The problem, when i'm trying to do this with selenium, it doesn't find me the xPath i provided, but when i'm trying this xPath by myself, it's finding the right place (the right checkbox to mark). so my question, is it even possible? and if it is, how??

Thank you!

edit:

one more problem that I noticed, is when after chrome is installed, before the first use, it's doesn't have yet in the chrome settings directory in :C:\Users\%%\AppData\Local\Google\Chrome\User Data\ any default profile. only after the first use it's shown. my question is from where this default profile coming from? i want to configure it before the first use.

解决方案

This is possible if you setup a browser profiles

这篇关于在C#中使用硒设置chrome设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆