Jump to content

WebDriver UDF - Help & Support (IV)


Recommended Posts

@DoVinhTrungMixing different technologies (Webdriver and WinAPI) can be problematic, so there may be a better alternative. You haven't told us what you want to accomplish with the converted hWnd, so it's difficult to know how to best guide you. Is there a reason that you can't tell us the Windows APIs that you intend to use?

Link to comment
Share on other sites

37 minutes ago, Danp2 said:

@DoVinhTrungMixing different technologies (Webdriver and WinAPI) can be problematic, so there may be a better alternative. You haven't told us what you want to accomplish with the converted hWnd, so it's difficult to know how to best guide you. Is there a reason that you can't tell us the Windows APIs that you intend to use?

i try use snapshoot bt webdriver but in active,i want change winapi hwnd for snapshoot

Link to comment
Share on other sites

@DoVinhTrungYou could run the browser in "headless" mode, where the browser isn't shown at all. There's an FAQ in the wiki that covers that. I believe it has also been discussed elsewhere in this forum.

P.S. It's best if you can paste without formatting when you use a language translator. That should avoid the white background and the oversized text. :thumbsup:

Link to comment
Share on other sites

  • 2 weeks later...
On 1/9/2023 at 11:09 PM, SOLVE-SMART said:

Hi @iSan,

yes your last code snippet looks good/should be correct.

So you still only receive one element which could be caused by an loading issue of the website. It's not very likely, but please add __WD_Sleep(2000) before you try to get the table rows. Just as an tryout. Could you maybe show us more screenshots from the website?ย Simply set MsgBox()ย commands before and after, take a screenshot, that's it.

Best regards
Sven

I have freetime now then i try this again and i found the point.

My pre-code:

$aTable = _WD_FindElement($sSession, 'xpath', '//table[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_gridTable"]//tr', Default, True)

New code:

$tElement = _WD_FindElement($sSession, 'xpath', '//table[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_gridTable"]' & '/tbody/tr', "", True)

I think the difference is '/tbody' before /trย 

Now i solved my problem, thank you.

Link to comment
Share on other sites

I'm trying to set value to an input element in a table.

I tryedย _WD_SetElementValue with Option_standard but got some issue:

$VAT_Element =_WD_FindElement($sSession, 'xpath', '//input[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_inputCell_1.22"]')
        _WD_SetElementValue($sSession, $VAT_Element, "10", $_WD_OPTION_Standard)
        Sleep(50)

Consol:

_WD_ElementAction ==> Element interaction issue [14] : Parameters:   Command=value   Option=<masked>

I tryedย _WD_SetElementValue with Option_advanced, that cleared entire row, the value is setย in the exact element i need

$VAT_Element =_WD_FindElement($sSession, 'xpath', '//input[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_inputCell_1.22"]')
        _WD_SetElementValue($sSession, $VAT_Element, "10", $_WD_OPTION_Advanced)
        Sleep(50)

image.png.8e793c4ec4121099f3f3595280eb1e49.png

Element of input id:

<input id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_inputCell_1.22" ondrop="return false" spellcheck="false" autocomplete="off" onchange="if($func.clientChange(this)) onChange$GridVoucherDetail$TaxCode(this);" onfocus="$find('ctl00_FastBusiness_MainReport_dirExtender_FormGridd98')._focus(this);" onblur="$find('ctl00_FastBusiness_MainReport_dirExtender_FormGridd98')._blur(this);" class="CellInput TextInput " type="text" value="" oncontextmenu="$func.showContextMenu(event, this, 'v', false);return false;" style="width: 100%;">

ย 

Link to comment
Share on other sites

@DoVinhTrungI imagine that you would get the same result if you ran the same Javascript code from the Dev Tools console. This would indicate that something is incorrect with your JS code. On second glance, you aren't returning a value, so that would explain the null. Try prepending "return " to your JS code.

Also, you should explain why you are attempting to retrieve the text this way instead of using _WD_ElementAction.

Link to comment
Share on other sites

@iSanImagine that you are an auto mechanic. Your client calls from out of town to say that the car is making a funny noise, then expects you to diagnose the problem without being able to see, touch, or listen to the car.

That's essentially what you are expecting us to do when you --

- don't post a short reproducer script, and
- don't provide detailed logs, and
- don't provide the target website or one that exhibits the same behavior

ย 

Link to comment
Share on other sites

@Danp2ย I know that i'm asking too much.

-The Website requires login to active. You can see the image i posted, i useย _WD_SetElementValue with Option_advanced to a cell in Row 1st, and it clears entire row, only fill the cell i chosed.ย 

-I use justย _WD_SetElementValue andย _WD_FindElement in core.au3 and help.au3, there are noย short reproducer script.

ย 

-This time when i tryย _WD_SetElementValue with Option_standard, showed in consol:

_WD_FindElement ==> Success [0] : Parameters:   Strategy=xpath   Selector=//input[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_inputCell_1.22"]   StartNodeID=Default   Multiple=Default   ShadowRoot=Default
__WD_Post ==> Element interaction issue [14] : HTTP status = 400
_WD_ElementAction ==> Element interaction issue [14] : Parameters:   Command=value   Option=<masked>
_WD_SetElementValue ==> Element interaction issue [14] : Parameters:    Element=b6225db5-7212-4723-ab51-eecc2ba57df3    Value=10    Style=0

I found it in core.au3 file:

$_WD_ERROR_ElementIssue, _ ; Problem interacting with element (click intercepted, etc)

Can you help me which part is the problem?

If my questions make you confuse, please ignore. I preciate your attention

Link to comment
Share on other sites

1 hour ago, iSan said:

$_WD_ERROR_ElementIssue

This would be the result if the webdriver returned an error indicating either "element click intercepted" or "element not interactable". If you increase the debug level to "full", then you would see the actual output in the logs.

Quote

The Website requires login to active.

That's fine. Is it one that we can access and create a test account? If not, then you should try to find an alternate website that demonstrates the same issues.

Link to comment
Share on other sites

@Danp2Seem like the input Element is not show, so i can not click or put value into it. I think i need to move scroll-bar to show the Elementย 

Image:

image.png.32c49635e85efc018a3f494e9911a27f.png

If i want to put value to Elements in column no 10, i need to move scroll-bar to show the Elements. I'm i right? Do you have any advice or suggest for me?

image.png.444ae8e514ee8cdad5aa266d09250cab.png

Ex: element of first cell in column no 10:

<td id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_gridCell_1.10" class="CellDefault" nowrap="" style="width: 80px; overflow: hidden; vertical-align: middle;"><div class="RowCellContainer" style="width: 80px; vertical-align: middle;"><input id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_inputCell_2.13" ondrop="return false" spellcheck="false" autocomplete="off" onchange="if($func.clientChange(this)) onChange$GridVoucherDetail$ImportTaxCode(this);" onfocus="$find('ctl00_FastBusiness_MainReport_dirExtender_FormGridd98')._focus(this);" onblur="$find('ctl00_FastBusiness_MainReport_dirExtender_FormGridd98')._blur(this);" class="CellInput TextInput " type="text" value="" oncontextmenu="$func.showContextMenu(event, this, 'v', false);return false;"></div></td>

ย 

Link to comment
Share on other sites

In addition to @Danp2ย statement:

1 hour ago, Danp2 said:

@iSanSorry, but I am not able to assist further without access to the target website.

me neither. You received several suggestions and hints about what we need to help you (seeย this postย orย this postย or others), but unfortunately you don't understand ๐Ÿ˜” .

It's simply not possible to help you without sharing the website or have a look atย a similar one. Either you find a way to provide such information in a clear way (record a video or whatever) or I personally don't see any chance for a valuable help.

Best regards
Sven

Edited by SOLVE-SMART

Stay innovative!

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)

Link to comment
Share on other sites

@Danp2That is the scroll-bar of a table in website, not scroll-bar of browser

@SOLVE-SMARTI try to get my own example websiteย and record a video.ย 

I have a table with 10 column Points, i use _WD_ElementAction to put value to cells in columns Points1 to Points5 thats OK. But iย try to put value into cells in columns Points7 to Points10 (video is columns Points8), did not work.

-Try withย _WD_ElementAction, found Element but got Element interaction issue, i guest Element ofย cells in columns Points7 to Points10 are hiden, need to move scroll-bar to show then useย _WD_ElementAction.

_WD_FindElement ==> Success [0] : Parameters:   Strategy=xpath   Selector=//input[@id="ctl00_FastBusiness_MainReport_dirExtender_FormGridd98_inputCell_1.22"]   StartNodeID=Default   Multiple=Default   ShadowRoot=Default
__WD_Post ==> Element interaction issue [14] : HTTP status = 400
_WD_ElementAction ==> Element interaction issue [14] : Parameters:   Command=value   Option=<masked>
_WD_SetElementValue ==> Element interaction issue [14] : Parameters:    Element=b6225db5-7212-4723-ab51-eecc2ba57df3    Value=10    Style=0

-Try with _WD_SetElementValue

_WD_SetElementValue($sSession, $VAT_Element, "10", $_WD_OPTION_Standard)

It clears entire Row1 like this, only 1st cell in columns Points8 have the value i set in:

image.thumb.png.a711877f5adca4a2249d9a136697311c.png

Is that clear? Please take a look and help me. Sory for bothering you.

Edited by iSan
Link to comment
Share on other sites

1 hour ago, Danp2 said:

๐Ÿคฎ๐Ÿ˜†

IMO, a video doesn't help when dealing with complex issues such as this.

That's why I wrote "or whatever" and refered to the posts with more common ways.ย 

Best regards
Sven

Edited by SOLVE-SMART

Stay innovative!

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)

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