Jump to content

Error when using in chrome "Data:,"


Recommended Posts


 

Good evening, I have a problem using my script in chrome to open a certain website. Returns me some popup and chrome has a white window

can you help me?
 

 

Script

#include ".\bibliotecas\wd_core.au3"
#include ".\bibliotecas\wd_helper.au3"

$site = "https:\\exemple.com/" 
$user = $CmdLine[1]
$password = $CmdLine[2]

Func SetupChrome() 
    _WD_Option('Driver', 'C:/Remote/Chrome/chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.Log') 
    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "binary":"C:/Remote/Chrome/chrome.exe", "args":["--start-maximized --ignore-certificate-errors"]}}}}'
    
EndFunc

Local $sDesiredCapabilities, $sSession 
SetupChrome() ;







_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession, $site) 
Sleep(500)
   $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='username']") 
      _WD_ElementAction($sSession, $sElement, 'value', $user)
      Sleep(600)

   $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='password']") 
   If @error = $_WD_ERROR_NoMatch Then
      MsgBox(0, "Erro", "ID ou Name do campo password nao encontrado.")
   EndIf
      _WD_ElementAction($sSession, $sElement, 'value', $password)
      Sleep(500)

   Send("{ENTER}")
   Sleep(500)


_WD_Shutdown() 

 

Edited by Jos
Please Copy&Paste without formatting the next time! ... and a codebox for the script.
Link to post
Share on other sites
#include ".\bibliotecas\wd_core.au3"
#include ".\bibliotecas\wd_helper.au3"

$site = "https:\\exemple.com/" 
$usuário = $CmdLine[1]
$senha = $CmdLine[2]

Func SetupChrome() 
    _WD_Option('Driver', 'C:/Remote/Chrome/chromedriver.exe')
    _WD_Option('Porta', 9515)
    _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.Log') 
    $sDesiredCapabilities = '{"capacities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "binary":"C:/Remote/Chrome/chrome.exe ", "args":["--start-maximized --ignore-certificate-errors"]}}}}'
    
EndFunc

Local $sDesiredCapabilities, $sSession 
SetupChrome() ;

 

 

 

_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)
_WD_Navigate($sSession, $site) 
Sleep(500)
   $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='username']") 
      _WD_ElementAction( $sSession, $sElement, 'value', $user)
      Sleep(600)

   $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='password']") 
   If @error = $_WD_ERROR_NoMatch Then
      MsgBox(0, "Erro", "ID ou Name do campo password não encontrado. ")
   EndIf
      _WD_ElementAction($sSession, $sElement, 'value', $password)
      Sleep(500)

   Send("{ENTER}")
   Sleep(500)


_WD_Shutdown()

That's it, it's formatted correctly (Thanks)

Attached, the images with the errors that occur when running the script

image.png

image.png

Link to post
Share on other sites

I tried with this script too 

 

#include ".\bibliotecas\wd_core.au3"
#include ".\bibliotecas\wd_helper.au3"



$site = "https:\\exemple.com" 
$user = $CmdLine[1]
$password = $CmdLine[2]
Local $sDesiredCapabilities, $sSession 
SetupChrome() 

_WD_Startup() 
$sSession = _WD_CreateSession($sDesiredCapabilities) 
_WD_Navigate($sSession, $site) 
   $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='username']") 
      _WD_ElementAction($sSession, $sElement, 'value', $user)
      Sleep(600)

   $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@name='password']") 
   If @error = $_WD_ERROR_NoMatch Then
      MsgBox(0, "Erro", "ID ou Name do campo password nao encontrado.")
   EndIf
      _WD_ElementAction($sSession, $sElement, 'value', $password)
      Sleep(500)

   Send("{ENTER}")
   Sleep(500)


Func SetupChrome() 
    _WD_Option('Driver', 'C:/Remote/Chrome/chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.Log') 

    $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "binary":"C:/Remote/Chrome/chrome.exe", "args":["--start-maximized --ignore-certificate-errors"]}}}}'
   
EndFunc

_WD_Shutdown()

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...