Authenticate Proxy with WebDriver php

0

I'm trying to log into a website to get information, but although it works perfectly in the outside environment of the company, when I squeeze the code inside my company's environment it blocks proxy authentication, which requires a password user.

The code I'm using is the following :

<?php

    namespace Facebook\WebDriver; //Definição do namespace
    use Facebook\WebDriver\Remote\DesiredCapabilities; //chamada à classe de drivers
    use Facebook\WebDriver\Remote\RemoteWebDriver; //chamada à classe de WebDriver
    use Facebook\WebDriver\WebDriverBy;

    header("Content-type: text/html; charset=utf-8"); //definindo o cabeçalho para utf-8

    require_once('vendor/autoload.php'); //realizando o autoload das classes pelo composer

    $url = 'https://sistemas.anatel.gov.br/sis/cadastrosimplificado/pages/acesso/login.xhtml?i=0&codSistema=649';

    $host = 'http://localhost:4444/wd/hub'; // Host default
    $capabilities = DesiredCapabilities::chrome(); // escolhendo o driver como chrome
    $driver = RemoteWebDriver::create($host, $capabilities, 5000); // criando uma nova conexão com o driver

    $driver->get($url); // realizando uma requisição HTTP get na $url

    /*
    $input = $driver->findElement(WebDriverBy::cssSelector('input[id="cpf_login"]'))->sendKeys('xxx.xxx.xxx-xx');

    */

    $login = $driver->findElement(WebDriverBy::cssSelector('input[name="cpf_login"]'))->sendKeys('XXX.XXX.XXX.XX');

    $senha = $driver->findElement(WebDriverBy::cssSelector('input[name="pwd"]'))->sendKeys('XXXXXXXXX');

    $entrar = $driver->findElement(WebDriverBy::name('j_idt51'))->click();

    //$driver->close();
    //#pwd
    //#cpf_login

    //$pesquisa->sendKeys(array(WebDriverKeys::ENTER)); //método sendKeys enviando um ENTER na pesquisa



    ?>

Can someone help me with how I can set the proxy as well as pass the user and password for authentication in this structure?

    
asked by anonymous 09.10.2018 / 15:21

0 answers