Jump to content

Recommended Posts

Posted

Hello Danp2, you mention in the header description of the _WD_WaitElement... "See defined constant $_WD_LOCATOR_* for allowed values". I am just missing it... but where is the $_WD_LOCATOR constant defined, so that I can see the allowed values, please?

Posted

Hello Danp2, I was talking about to make a donation... Also, how can you select a particular item in a list using the Chrome driver?  I saw an example and can't relocate it again...

Posted

Hello Dan, I have a table of reports... how can I access the values in the table and click on the "View" link for the report that I want using the Chrome webdriver. Please see attachment...

table_of_reports.JPG

Posted
5 minutes ago, lponthepc said:

Hello Dan, I have a table of reports... how can I access the values in the table and click on the "View" link for the report that I want using the Chrome webdriver. Please see attachment... if I could search the "title" attribure in the td element, and then click on that "View" link, would be good. 

table_of_reports.JPG

 

Posted

Hello Mr. Danp2, can you tell me how you can get a table, and go through all of the records in the td of the table...? Using IE you can get the collection with _IETagNameGetCollection or _IEFrameGetCollection... is there any method to traverse a table in Chrome...???

Posted

@Danp2 I tried DanyLarson's code for html table extraction.  I am having problem with this line getting the count of the header cells.

    $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $BaseElement & "/tbody/tr[1]/td", "", True)
    $ColNumber = UBound($aElements)

The $ColNumber returns zero count.  However, the next lines return all the cell counts.

    $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $BaseElement & "/tbody/tr/td", "", True)
    $CellNumber = UBound($aElements)

Could you please take a look to see why with restriction to the first row, "tr[1]/td", does not return any array count....Thanks

Posted

Hi Dan,

we would like to open a new window in the same Firefox instance instead of a tab in the same Firefox window. We cannot use AutoIt-"run" because of "AllowMultipleInstances=true" in the wrapper of portable apps. We need this, because we have to run two different Firefox versions at the same time.

_WD_NewWindow($sSession) instead of _WD_NewTab($sSession) would help. Other idea?

Thanks for your help.

 

 

Posted
On 1/14/2019 at 3:31 AM, danylarson said:

Hi Dan,

Thanks for your review i noticed my mistake.

Here is an improved version of my fonction to get Table content :

Func _WD_GetTableContent($sSession, $aElements, $Separator, $ContainHeader = "")

    Local $BaseElement
    Local $LineNumber
    Local $ColNumber
    Local $i
    local $j
    Local $sValue
    Local $TmpValue
    Local $StartCell

    $BaseElement = $aElements

    $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $BaseElement & "/tbody/tr", "", True)
    $LineNumber = UBound($aElements)

    $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $BaseElement & "/tbody/tr[1]/td", "", True)
    $ColNumber = UBound($aElements)

    Local $sArray = [$LineNumber]

    $aElements = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $BaseElement & "/tbody/tr/td", "", True)
;~     _ArrayDisplay($aElements)

    $CellNumber = UBound($aElements)

    If $ContainHeader = "" Then

        $StartCell = 0

    Else

        $StartCell = $ColNumber

    EndIf

    For $i = $StartCell To $CellNumber - 1

        $sElement = $aElements[$i]
        $TmpValue = _WD_ElementAction($sSession, $sElement, 'Text')
        $sValue = $sValue & "##" & $TmpValue

        $j = $j + 1

        If $j = $ColNumber Then

            _ArrayAdd($sArray, $sValue)
            $sValue = ""
            $j = ""

        EndIf

    Next

    For $i = 1 To UBound($sArray) - 1

        $TmpValue = $sArray[$i]
        $TmpValue = StringMid($TmpValue, 3)
        $TmpValue = StringReplace($TmpValue, "##", $Separator)

        $sArray[$i] = $TmpValue

    Next

    Return $sArray

EndFunc   ;==>_WD_GetTableContent

Hello Dan2, I used this function and I get an error.  I am trying to get the content from a table... This is my error...

Unable to locate an element with the xpath expression 14d18d66-2e47-4995-b669-3bc9ed9d1dbc/tbody/tr because of the following error:\nSyntaxError: Failed to execute 'evaluate' on 'Document': The string '14d18d66-2e47-4995-b669-3bc9ed9d1dbc/tbody/tr' is not a valid XPath expression.

This is what I use to call the function...

$sTableV = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//table[@class='"&$sTable_Class&"']")
_ArrayDisplay(_WD_GetTableContent($sSession, $sTableV, "##"))

FindElement returns the element, but when I pass that element to GetTableContent I get the error above... so you can see the guid appended to the /tbody/tr... what am I doing wrong...???

Posted

Why some time, does chrome fail to start... I get this error code: "__WD_Post: StatusCode=404; ResponseText={"value":{"error":"invalid session id","message":"invalid session id","stacktrace" 

And when you do get this error, how can you get an alert, an stop the rest of the script from running???

Also, how can you stop Chrome from coming up and saying... "Chrome is being controlled by automated test software"... with the "data;, tab.  I never programmed it to do that in my script... So where does the "data;," tab come from...?

 

image.png.10ac6e06d4d497d0dbe2522f5da26721.png

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...