Je suis en train de courir sans tête chrome en utilisant le sélénium en C#, mais je continue à obtenir cette erreur:Headless Chrome avec Sélénium en C#
You are using an unsupported command-line flag: --ignore-certificate-errors, Stability and security will suffer.
J'utilise
- Chrome: 61
- ChromeDriver: 2,3
- Sélénium: 3,6
- .Net 4,5
Mon code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
namespace MyApp {
public partial class Form1: Form {
public Form1() {
InitializeComponent();
}
private void StartBtn_Click(object sender, EventArgs e) {
string appPath = AppDomain.CurrentDomain.BaseDirectory;
IWebDriver driver;
ChromeOptions options = new ChromeOptions();
options.AddArguments("--headless", "--disable-gpu", "--remote-debugging-port=9222", "--window-size=1440,900");
driver = new ChromeDriver(options);
}
}
}
Mon application WinForm a un seul bouton avec le nom "StartBtn".
vous pouvez essayer d'utiliser PhantomJS au lieu. –
@RichBryant Chrome est plus stable et meilleur en performance que PhantomJs. – Raven
discutable. fantôme a tendance à jouer plutôt plus bien avec les options de la ligne de commande. –