Jump to content

Recommended Posts

Posted (edited)
Global $_WD_DRIVER, $aElements, $dateIn, $Date_long_format, $BAILIIcite, $ncn, $xHTML, $cite
Local $sDesiredCapabilities
$_WD_DEBUG = $_WD_DEBUG_None

$ioc_clip = ClipGet()
SetupGecko()
_WD_Startup()
$sSession = _WD_CreateSession($sDesiredCapabilities)

For $page = 0 To 13
    _WD_Navigate($sSession, $ioc_clip & '&page=' & $page)
    $Handle = _WD_Window($sSession, 'window', '')

    Sleep(1000)
    $sHTML = _WD_GetSource($sSession)
    $sHTML2 = StringRegExpReplace($sHTML, '<strong>(.*?)</strong>', '\1')
    Sleep(1000)
    Local $aArray = StringRegExp($sHTML2, '<a class="block group" href="(.*?(ic-\w+)-\w+/)">.*?light">(.*?)</h4>.*?(\d+ \w+ (\d{4}))[\s,-]+(.*?)</p>((?s).*?(?-s)class="p-1 inline-block ml-2" style="background-color: ;">.*?</span></li></ul>).*?', 4)
    $cite = $aArray[2]
    check_citation($cite)
Next
_WD_DeleteSession($sSession)
_WD_Shutdown()
Exit

Func SetupGecko()
    _WD_Option('Driver', $resources & 'geckodriver.exe')
    _WD_Option('Port', 4444)
    $sDesiredCapabilities = '{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}'
EndFunc   ;==>SetupGecko

Func check_citation($ncn)
    _WD_Navigate($sSession, 'https://..../check...=' & $ncn & '&urlonly')
    $Handle = _WD_Window($sSession, 'window', '')
    $xHTML = _WD_GetSource($sSession)
    If StringInStr($xHTML, "/cases/") Then
        Sleep(2000)
        ConsoleWrite('On:   ' & $cite & @CRLF)
    Else
        ConsoleWrite('NotI: ' & $cite & @CRLF)
    EndIf
EndFunc   ;==>check_citation

I'm running a WD_DRIVER session which contains a function that also contains another WD_DRIVER session to another website - both need to continue to be open is this possible if so how do I identify the second session (within the function)? 

Edited by Jury
Posted

Hi @Jury,

please explain more. Tell us about your understanding what a session is in your context and what do you exactly mean by a function within a session?
I would like to help you regarding "multiple webdriver sessions", but what you descibed doesn't match with the title or I simply don't understand it.

In general: you can run multiple WebDriver sessions with multiple driver (chromedriver.exe, geckodriver.exe ...). Maybe the FAQ section is helpful.

Best regards
Sven

==> AutoIt related: 🔗 Organization AutoIt Community🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet🔗 autoit-webdriver-boilerplate

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

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
×
×
  • Create New...