Jump to content

Driver geckodriver maybe someone can help


Go to solution Solved by SmOke_N,

Recommended Posts

Hi

First time used webdriver udf

i use A simple code to open and refresh the page

Everything is excellent except for one thing there's a website using CAPTCHA (see the attach pic)

The problem when the website is opened via WD -(firefox)-, the CAPTCHA on the website fails!

But when I use firefox normally it is confirmed successful

hope someone help solve the problem and explains to me why it happened.

 

#include <MsgBoxConstants.au3>
#include <wd_core.au3>
#include <wd_helper.au3>
#include "wd_capabilities.au3"

; Here you can specify some browser specific settings... you'll need to research them depending on your browser
; ... or just copy paste someone else's code :D

#Region Settings Setup
  _WD_Option('Driver', 'geckodriver.exe')
  _WD_Option('DriverParams', '--log trace')
  _WD_Option('Port', 4444)
 _WD_CapabilitiesAdd('args', '--headless')
  Global $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}'
#EndRegion Settings Setup

; You need to initialize some stuff with this UDF
_WD_Startup()
; If there is an error setting stuff up, then exit
If @error <> $_WD_ERROR_Success Then
    Exit -1
EndIf
Sleep(10000)
; Create a new instance of a browser with some settings you request
Global $sSession = _WD_CreateSession($sDesiredCapabilities)
; If there was an error, exit
If Not (@error = $_WD_ERROR_Success) Then Exit MsgBox($MB_ICONERROR, "Error: _WD_CreateSession", "Failed to create a Session. Check your desired capabilities.")

; Move to the requested website
_WD_Navigate($sSession, "URL")

_WD_LoadWait($sSession,500,500,500,500)
_WD_Action($sSession, 'REFRESH')

MsgBox($MB_ICONINFORMATION, "Navigation completed!", _WD_Action($sSession, 'TITLE'))

If @error Then
MsgBox($MB_ICONINFORMATION, "Navigation completed!", _WD_LastHTTPResponse())
EndIf

; This removes the browser instance
_WD_DeleteSession($sSession)

; And this cleans up some resources
_WD_Shutdown()

 

555555.jpg

Link to comment
Share on other sites

  • Moderators
  • Solution
On 2/27/2024 at 1:21 AM, DCCD said:

Hi

First time used webdriver udf

i use A simple code to open and refresh the page

Everything is excellent except for one thing there's a website using CAPTCHA (see the attach pic)

The problem when the website is opened via WD -(firefox)-, the CAPTCHA on the website fails!

But when I use firefox normally it is confirmed successful

hope someone help solve the problem and explains to me why it happened.

 

#include <MsgBoxConstants.au3>
#include <wd_core.au3>
#include <wd_helper.au3>
#include "wd_capabilities.au3"

; Here you can specify some browser specific settings... you'll need to research them depending on your browser
; ... or just copy paste someone else's code :D

#Region Settings Setup
  _WD_Option('Driver', 'geckodriver.exe')
  _WD_Option('DriverParams', '--log trace')
  _WD_Option('Port', 4444)
 _WD_CapabilitiesAdd('args', '--headless')
  Global $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}'
#EndRegion Settings Setup

; You need to initialize some stuff with this UDF
_WD_Startup()
; If there is an error setting stuff up, then exit
If @error <> $_WD_ERROR_Success Then
    Exit -1
EndIf
Sleep(10000)
; Create a new instance of a browser with some settings you request
Global $sSession = _WD_CreateSession($sDesiredCapabilities)
; If there was an error, exit
If Not (@error = $_WD_ERROR_Success) Then Exit MsgBox($MB_ICONERROR, "Error: _WD_CreateSession", "Failed to create a Session. Check your desired capabilities.")

; Move to the requested website
_WD_Navigate($sSession, "URL")

_WD_LoadWait($sSession,500,500,500,500)
_WD_Action($sSession, 'REFRESH')

MsgBox($MB_ICONINFORMATION, "Navigation completed!", _WD_Action($sSession, 'TITLE'))

If @error Then
MsgBox($MB_ICONINFORMATION, "Navigation completed!", _WD_LastHTTPResponse())
EndIf

; This removes the browser instance
_WD_DeleteSession($sSession)

; And this cleans up some resources
_WD_Shutdown()

 

555555.jpg

 

Forum Rules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...