Jump to content

WebDriver UDF - Help & Support


Recommended Posts

Thanks! @Danp2 

I changed my code to the following and I was able to find (highlight) the element I need to address.  Unfortunantly I am still unable to get the Text from the element. Does my approach with "'attribute', 'text'" even exist, or do I need to get other functions involved?

$ogetname = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//strong", "", True)
   _WD_HighlightElement($sSession, $ogetname[0], 1)
   $oResult = _WD_ElementAction($sSession, $ogetname[0], 'Attribute', 'text')
   MsgBox(0, "Result", $oResult)

From the output I got: _WD_ElementAction: {"value":null}...

Quote

__WD_Post: URL=HTTP://127.0.0.1:9515/session/46d9e3b23f54a7194ca99cc899425a25/elements; $sData={"using":"xpath","value":"//strong"}
__WD_Post: StatusCode=200; ResponseText={"value":[{"element-6066-11e4-a52e-4f735466cecf":"334436cb-58b8-4410-8cb5-887b3f1496f4"},{"element-6066-11e4-a52e-4f735466cecf":"0ca446e2-2531-456b-89b4-5e7ed1816822"},{"element-6066-11e4-a52e-4f735466cecf":"31ac7e8b-890b-494d-a789-5babbc235ddc"},{"element-6066-11e4-a52e-4f735466cecf":"fd7aaa9d-9c7e-4e90-a7f0-51bd640fadc2"},{"element-6066-11e4-a52e-4f735466cecf":"ce38f14d-3ef4-409e-8b82-79acf8e609ce"},{"element-6066-11e4-a52e-4f735466cecf":"a251656c-88a0-47c0-bed9-bee8e1a7cf26"},{"element-6066-11e4-a52e-4f735466cecf":"e7d83455-0cef-4068-8bcb-a6f03c7fba9f"},{"element-6066-11e4-a52e-4f735466cecf":"f388919a-fc83-47b5-a230-b4112f8d0850"},{"element-6066-11e4-a52e-4f735466cecf":"5aa2f5a8-e1b2-4cf5-beb3-b40b3ee223f8"},{"element-6066-11e4-a52e-4f735466cecf":"dc45528e-3786-4ce7-80cd-838f4fc04f7c"},{"element-6066-11e4-a52e-4f735466cecf":"1cee4464-7aa6-4ef5-afc5-c3e59783ecd2"},{"element-6066-11e4-a52e-4f735466cecf":"0360df22-f333-4459-b210-dc532f29e48b"},{"element-6066-11e4-a52e-4f735466cecf":"63ad7f00-a888-49ac-b642-a67e6b022750"},{"element-6066-11e4-a52e-4f735466cecf":"fdde9689-8d6d-4fee-b1e9-f0fa36578d71"},{"element-6066-11e4-a52e-4f735466cecf":"bb6e24f1-5b97-4931-8ef5-d10a5fb7b675"},{"element-6066-11e4-a52e-4f735466cecf":"007cb0bc-5de5-464a-83e2-ad1e18cc47d7"},{"element-6066-11e4-a52e-4f735466cecf":"06703516-5bf0-4716-a077-0fdaf41ed68e"},{"element-6066-11e4-a52e-4f735466cecf":"fdcd6cf0-cc24-4be0-9d00-98a5d725a912"},{"element-6066-11e4-a52e-4f735466cecf":"5ef053e5-0e8d-4e70-a48f-35b916f7f2a1"},{"element-6066-11e4-a52e-4f735466cecf":"c3c00fa3-fc2c-4658-bc98-f04746d02709"},{"element-6066-11e4-a52e-4f735466cecf":"27dd4235-de4e-4447-9461-78a262e48033"},{"element-6066-11e4-a52e-4f735466cecf":"6550eb76-31c0-4481-a975-c3d72c68369b"},{"element-6066-11e4-a52e-4f735466cecf":"d1078cce-4bd8-43bd-9570-86e37e09fd3c"},{"element-6066-11e4-a52e-4f735466cecf":"46d34f6e-9417-4017-a5c9-c28d9bb50d82"},{"element-6066-11e4-a52e-4f735466cecf":"2eba6800-d80b-40f1-b496-558366bef4ff"},{"element-6066-11e4-a52e-4f735466cecf":"3461a5c8-6094-4686-aeea-75580a7676ba"},{"element-6066-11e4-a52e-4f735466cecf":"77ef438e-b4fb-4edf-8778-d9e6bba8bdb8"},{"element-6066-11e4-a52e-4f735466cecf":"f20c6776-90f7-4d28-a61b-500da1ddf787"},{"element-6066-11e4-a52e-4f735466cecf":"c21d0ac9-e598-423d-bfc3-65ea0d3d2e26"},{"element-6066-11e4-a52e-4f735466cecf":"20543dec-77d4-4a5c-a5b6-dd116150cdfc"},{"element-6066-11e4-a52e-4f735466cecf":"d61be89f-3942-4570-aeab-bdcd8328f610"},{"element-6066-11e4-a52e-4f735466cecf":"7b036745-7e20-423f-a76e-8ed58c2bfb5b"},{"element-6066-11e4-a52e-4f735466cecf":"bd25122f-e111-47a0-8222-c350eb4440f6"},{"element-6066-11e4-a52e-4f735466cecf":"f51e711f-79db-4855-b7c4-e5cdd8e72dae"},{"element-6066-11e4-a52e-4f735466cecf":"9642defd-fcd0-4163-8f1c-0b4fd04d2725"},{"element-6066-11e4-a52e-4f735466cecf":"f913deeb-7b2f-476b-a5ad-4492e4c00e0d"},{"element-6066-11e4-a52e-4f735466cecf":"37fe3fe1-ab76-4263-87bc-6632b97fd143"},{"element-6066-11e4-a52e-4f735466cecf":"cc413c23-cdb6-4083-9ffa-a6550d0a3f9a"},{"element-6066-11e4-a52e-4f735466cecf":"36c7bee3-f614-41fc-942c-61bb3d9262f6"},{"element-6066-11e4-a52e-4f735466cecf":"6c55e38d-1235-4567-b1bd-13d3324bcb10"},{"element-6066-11e4-a52e-4f735466cecf":"a63f7d78-bafc-4d5d-a6a7-ff38f2ae8e1c"},{"element-6066-11e4-a52e-4f735466cecf":"690f283d-ffd5-410a-954b-659ac63ff9f1"},{"element-6066-11e4-a52e-4f735466cecf":"6ac11dca-06ea-44be-bcb2-f7b2aa5cd43c"},{"element-6066-11e4-a52e-4f735466cecf":"52800cec-52bb-457b-b77e-2a6a4b5ccfbe"},{"element-6066-11e4-a52e-4f735466cecf":"c42f6dbb-fc6e-41c4-957f-53e14e79513f"},{"element-6066-11e4-a52e-4f735466cecf":"9a54c2b8-22f1-48f5-b781-a244255713e0"},{"element-6066-11e4-a52e-4f735466cecf":"5f7b8760-0ea1-4358-ba12-10842a2073c5"}]}
_WD_FindElement: {"value":[{"element-6066-11e4-a52e-4f735466cecf":"334436cb-58b8-4410-8cb5-887b3f1496f4"},{"element-6066-11e4-a52e-4f735466cecf":"0ca446e2-2531-456b-89b4-5e7ed1816822"},{"element-6066-11e4-a52e-4f735466cecf":"31ac7e8b-890b-494d-a789-5babbc235ddc"},{"element-6066-11e4-a52e-4f735466cecf":"fd7aaa9d-9c7e-4e90-a7f0-51bd640fadc2"},{"element-6066-11e4-a52e-4f735466cecf":"ce38f14d-3ef4-409e-8b82-79acf8e609ce"},{"element-6066-11e4-a52e-4f735466cecf":"a251656c-88a0-47c0-bed9-bee8e1a7cf26"},{"element-6066-11e4-a52e-4f735466cecf":"e7d83455-0cef-4068-8bcb-a6f03c7fba9f"},{"element-6066-11e4-a52e-4f735466cecf":"f388919a-fc83-47b5-a230-b4112f8d0850"},{"element-6066-11e4-a52e-4f735466cecf":"5aa2f5a8-e1b2-4cf5-beb3-b40b3ee223f8"},{"element-6066-11e4-a52e-4f735466cecf":"dc45528e-3786-4ce7-80cd-838f4fc04f7c"},{"element-6066-11e4-a52e-4f735466cecf":"1cee4464-7aa6-4ef5-afc5-c3e59783ecd2"},{"element-6066-11e4-a52e-4f735466cecf":"0360df22-f333-4459-b210-dc532f29e48b"},{"element-6066-11e4-a52e-4f735466cecf":"63ad7f00-a888-49ac-b642-a67e6b022750"},{"element-6066-11e4-a52e-4f735466cecf":"fdde9689-8d6d-4fee-b1e9-f0fa36578d71"},{"element-6066-11e4-a52e-4f735466cecf":"bb6e24f1-5b97-4931-8ef5-d10a5fb7b675"},{"element-6066-11e4-a52e-4f735466cecf":"007cb0bc-5de5-464a-83e2-ad1e18cc47d7"},{"element-6066-11e4-a52e-4f735466cecf":"06703516-5bf0-4716-a077-0fdaf41ed68e"},{"element-6066-11e4-a52e-4f735466cecf":"fdcd6cf0-cc24-4be0-9d00-98a5d725a912"},{"element-6066-11e4-a52e-4f735466cecf":"5ef053e5-0e8d-4e70-a48f-35b916f7f2a1"},{"element-6066-11e4-a52e-4f735466cecf":"c3c00fa3-fc2c-4658-bc98-f04746d02709"},{"element-6066-11e4-a52e-4f735466cecf":"27dd4235-de4e-4447-9461-78a262e48033"},{"element-6066-11e4-a52e-4f735466cecf":"6550eb76-31c0-4481-a975-c3d72c68369b"},{"element-6066-11e4-a52e-4f735466cecf":"d1078cce-4bd8-43bd-9570-86e37e09fd3c"},{"element-6066-11e4-a52e-4f735466cecf":"46d34f6e-9417-4017-a5c9-c28d9bb50d82"},{"element-6066-11e4-a52e-4f735466cecf":"2eba6800-d80b-40f1-b496-558366bef4ff"},{"element-6066-11e4-a52e-4f735466cecf":"3461a5c8-6094-4686-aeea-75580a7676ba"},{"element-6066-11e4-a52e-4f735466cecf":"77ef438e-b4fb-4edf-8778-d9e6bba8bdb8"},{"element-6066-11e4-a52e-4f735466cecf":"f20c6776-90f7-4d28-a61b-500da1ddf787"},{"element-6066-11e4-a52e-4f735466cecf":"c21d0ac9-e598-423d-bfc3-65ea0d3d2e26"},{"element-6066-11e4-a52e-4f735466cecf":"20543dec-77d4-4a5c-a5b6-dd116150cdfc"},{"element-6066-11e4-a52e-4f735466cecf":"d61be89f-3942-4570-aeab-bdcd8328f610"},{"element-6066-11e4-a52e-4f735466cecf":"7b036745-7e20-423f-a76e-8ed58c2bfb5b"},{"element-6066-11e4-a52e-4f735466cecf":"bd25122f-e111-47a0-8222-c350eb4440f6"},{"element-6066-11e4-a52e-4f735466cecf":"f51e711f-79db-4855-b7c4-e5cdd8e72dae"},{"element-6066-11e4-a52e-4f735466cecf":"9642defd-fcd0-4163-8f1c-0b4fd04d2725"},{"element-6066-11e4-a52e-4f735466cecf":"f913deeb-7b2f-476b-a5ad-4492e4c00e0d"},{"element-6066-11e4-a52e-4f735466cecf":"37fe3fe1-ab76-4263-87bc-6632b97fd143"},{"element-6066-11e4-a52e-4f735466cecf":"cc413c23-cdb6-4083-9ffa-a6550d0a3f9a"},{"element-6066-11e4-a52e-4f735466cecf":"36c7bee3-f614-41fc-942c-61bb3d9262f6"},{"element-6066-11e4-a52e-4f735466cecf":"6c55e38d-1235-4567-b1bd-13d3324bcb10"},{"element-6066-11e4-a52e-4f735466cecf":"a63f7d78-bafc-4d5d-a6a7-ff38f2ae8e1c"},{"element-6066-11e4-a52e-4f735466cecf":"690f283d-ffd5-410a-954b-659ac63ff9f1"},{"element-6066-11e4-a52e-4f735466cecf":"6ac11dca-06ea-44be-bcb2-f7b2aa5cd43c"},{"element-6066-11e4-a52e-4f735466cecf":"52800cec-52bb-457b-b77e-2a6a4b5ccfbe"},{"element-6066-11e4-a52e-4f735466cecf":"c42f6dbb-fc6e-41c4-957f-53e14e79513f"},{"element-6066-11e4-a52e-4f735466cecf":"9a54c2b8-22f1-48f5-b781-a244255713e0"},{"element-6066-11e4-a52e-4f735466cecf":"5f7b8760-0ea1-4358-ba12-10842a2073c5"}]}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/46d9e3b23f54a7194ca99cc899425a25/execute/sync; $sData={"script":"arguments[0].style='border: 2px dotted red'; return true;", "args":[{"element-6066-11e4-a52e-4f735466cecf":"334436cb-58b8-4410-8cb5-887b3f1496f4"}]}
__WD_Post: StatusCode=200; ResponseText={"value":true}
_WD_ExecuteScript: {"value":true}
__WD_Get: URL=HTTP://127.0.0.1:9515/session/46d9e3b23f54a7194ca99cc899425a25/element/334436cb-58b8-4410-8cb5-887b3f1496f4/attribute/text
__WD_Get: StatusCode=200; $iResult = 0; $sResponseText={"value":null}...
_WD_ElementAction: {"value":null}...

Thank you as always for any inputs :)

Link to comment
Share on other sites

4 hours ago, _leo_ said:

does my approach with "'attribute', 'text'" even exist, or do I need to get other functions involved?

You need to figure out the correct method to retrieve the desired value. Best way to do that is to use the browser's developer tools to examine the element and see what properties / attributes are available.

From what I can tell, you should be able to use either InnerText or textContent to retrieve the text you're after. Not positive, but I think these are properties, so I would try that before attribute.

Link to comment
Share on other sites

_WD_Option("Driver", "geckodriver.exe")
_WD_Option("DriverParams", "--log trace")
_WD_Option("Port", 4444)
_WD_Startup()
$sSession = _WD_CreateSession('{"desiredCapabilities":{"javascriptEnabled":true,"nativeEvents":true,"acceptInsecureCerts":true}}')
_WD_LoadWait($sSession, 600, -1)
_WD_Navigate($sSession, "https://www.flashscores.co.uk")
$readhtml = ????????????????  ReadHTML code help
FileWrite("ss.txt" ,$readhtml)
_WD_DeleteSession($sSession)
_WD_Shutdown()

Link to comment
Share on other sites

1 hour ago, CYCho said:

@ronaldinho424 You can use _WD_GetSource($sSession) funtion.

thankyou geckodriver.exe hide run frefox hide run

 

_WD_Option('Driver', 'chromedriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')
_WD_Startup()
$sSession = _WD_CreateSession('{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}')
_WD_LoadWait($sSession, 600, -1)
_WD_Navigate($sSession, "https://www.google.com")
FileWrite("Write.txt" ,_WD_GetSource($sSession))
_WD_DeleteSession($sSession)
_WD_Shutdown()

 

NLOLmQ.png

Link to comment
Share on other sites

16 minutes ago, ronaldinho424 said:

thankyou. Firefox and Chrome run hide

 

16 minutes ago, ronaldinho424 said:

_WD_Option('Driver', 'chromedriver.exe')
_WD_Option('Port', 9515)
_WD_Option('DriverParams', '--log-path="' & @ScriptDir & '\chrome.log"')
_WD_Startup()
$sSession = _WD_CreateSession('{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true }}}}')
_WD_LoadWait($sSession, 600, -1)
_WD_Navigate($sSession, "https://www.google.com")
FileWrite("Write.txt" ,_WD_GetSource($sSession))
_WD_DeleteSession($sSession)
_WD_Shutdown()

 

NLOLmQ.png

 

Link to comment
Share on other sites

  • 2 weeks later...

Hey there,

I run into a weird problem. I am unable to interact with almost any button on a website. (requires registration) Although the console output looks fine, the element does not react. For demonstration purposes I am just posting one case, where it is not working. The problem occured the fist time after I switched to my new laptop. But everything is installed as it should.

_WDStartup: OS: WIN_10 WIN32_NT 17763 
_WDStartup: AutoIt: 3.3.14.5
_WDStartup: WD.au3: 0.1.0.20
_WDStartup: Driver: chromedriver.exe
_WDStartup: Params: --log-path="C:\Users\leona\Desktop\chrome.log"
_WDStartup: Port:   9515
76.0.3809.100 Chrome

My code:

_WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='upload-button-wrapper replace-all-images']", $iPause*10, $iPause*45) ;Upload
   $oUpload = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//div[@class='upload-button-wrapper replace-all-images']")
   $oUpload2 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='select-image-base']")
   $oUpload3 = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//button[@class='uploader-button secondary upload-button']")
   _WD_ElementAction($sSession, $oUpload, 'click')
   _WD_ElementAction($sSession, $oUpload2, 'click')
   _WD_ElementAction($sSession, $oUpload3, 'click')
Quote

_WD_Post: URL=HTTP://127.0.0.1:9515/session/c306cff0043803443273866ef8d5b29c/element; $sData={"using":"xpath","value":"//div[@class='upload-button-wrapper replace-all-images']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"f249219e-d4f9-4b72-abb9-1637c8da690d"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"f249219e-d4f9-4b72-abb9-1637c8da690d"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/c306cff0043803443273866ef8d5b29c/element; $sData={"using":"xpath","value":"//input[@id='select-image-base']"}
__WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"6d8dd48d-f1b4-48d4-8e5d-321f0ab88c8b"}}
_WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"6d8dd48d-f1b4-48d4-8e5d-321f0ab88c8b"}}
__WD_Post: URL=HTTP://127.0.0.1:9515/session/c306cff0043803443273866ef8d5b29c/element/f249219e-d4f9-4b72-abb9-1637c8da690d/click; $sData={"id":"f249219e-d4f9-4b72-abb9-1637c8da690d"}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_ElementAction: {"value":null}...
__WD_Post: URL=HTTP://127.0.0.1:9515/session/c306cff0043803443273866ef8d5b29c/element/6d8dd48d-f1b4-48d4-8e5d-321f0ab88c8b/click; $sData={"id":"6d8dd48d-f1b4-48d4-8e5d-321f0ab88c8b"}
__WD_Post: StatusCode=200; ResponseText={"value":null}
_WD_ElementAction: {"value":null}...

Autoit.PNG

Edited by _leo_
Link to comment
Share on other sites

@_leo_ Even though the site requires registration, it may help if we can take a look at the main site to determine the underlying architecture in use. Have you looked into the event listeners attached to these elements? Have you tried using the browser's developer console to manually interact with these controls?

Link to comment
Share on other sites

@Danp2

Thank you! I looked at the Developer  Tools and found the following Event listeners for all not responding elements. I have not tried to interact manually, but I found an interesting chrome output. The website I am trying to interact with is called: www.redbubble.com

 

console.PNG

event.PNG

Link to comment
Share on other sites

5 hours ago, ronaldinho424 said:

ChromeDriver 71.0.3578.80 works this version.

ChromeDriver 77.0.3865.10 does not work in this version.

"Doesn't work" isn't sufficient for us to diagnose the issue. Please give us the exact browser version as well. Then post the following --

  • A short script to demonstrate the problem
  • The results from the Scite output panel
Link to comment
Share on other sites

I would like to remove message from googlechrome being automated I inserted the following code,

'{"capabilities": {"alwaysMatch": {"goog: chromeOptions": {"w3c": true, "args": ["start-maximized" , "- disable-infobars"]}}}} '

Can anybody help me ?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...