सेलेनियम और सी # के माध्यम से इसका उपयोग करते समय Google क्रोम में छवियों को कैसे अक्षम करता है?सेलेनियम में छवियों को अक्षम करें Google क्रोमड्राइवर
मैंने 6 तरीकों का प्रयास किया है और कोई भी काम नहीं किया है। मैंने this स्टैक ओवरफ्लो प्रश्न पर भी उत्तर देने का प्रयास किया है, हालांकि मुझे लगता है कि इसमें जानकारी पुरानी है।
- क्रोम चालक: V2.2
- Chrome संस्करण: V29.0.1547.66 मीटर
- सेलेनियम: V2.35
सभी प्रयास मैं कर दिया है अपवाद का कारण नहीं है , वे सामान्य रूप से चलाने, लेकिन अभी भी छवियों को प्रदर्शित:
प्रयास 1:
ChromeOptions co = new ChromeOptions();
co.AddArgument("--disable-images");
IWebDriver driver = new ChromeDriver(co);
प्रयास 2:
DesiredCapabilities capabilities = DesiredCapabilities.Chrome();
capabilities.SetCapability("chrome.switches", new string[1] { "disable-images" });
प्रयास 3:
ChromeOptions co = new ChromeOptions();
co.AddAdditionalCapability("chrome.switches", new string[1] { "disable-images" });
प्रयास 4:
var imageSetting = new Dictionary<string, object>();
imageSetting.Add("images", 2);
Dictionary<string, object> content = new Dictionary<string, object>();
content.Add("profile.default_content_settings", imageSetting);
var prefs = new Dictionary<string, object>();
prefs.Add("prefs", content);
var options = new ChromeOptions();
var field = options.GetType().GetField("additionalCapabilities", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
var dict = field.GetValue(options) as IDictionary<string, object>;
if (dict != null)
dict.Add(ChromeOptions.Capability, prefs);
}
प्रयास 5:
ChromeOptions options = new ChromeOptions();
options.AddAdditionalCapability("profile.default_content_settings", 2);
प्रयास 6:
Dictionary<String, Object> contentSettings = new Dictionary<String, Object>();
contentSettings.Add("images", 2);
Dictionary<String, Object> preferences = new Dictionary<String, Object>();
preferences.Add("profile.default_content_settings", contentSettings);
DesiredCapabilities caps = DesiredCapabilities.Chrome();
caps.SetCapability("chrome.prefs", preferences);
क्या आपने उस प्रश्न में समाधान का प्रयास किया था? आप क्रोमड्राइवर का किस संस्करण का उपयोग कर रहे हैं? कृपया जिस तरीके से आपने कोशिश की है और यह कैसे काम नहीं किया है (अगर यह छवियों को अक्षम नहीं करता है या अगर यह त्रुटि उत्पन्न करता है) तो पोस्ट करें (सटीक कोड)। – Arran
संभावित डुप्लिकेट [सेलेनियम क्रोमड्राइवर में छवियों को अक्षम करें] (http://stackoverflow.com/questions/9433109/disable-images-in-selenium-chromedriver) – jww