Jump to content

TheOne23

Active Members
  • Posts

    119
  • Joined

  • Last visited

  • Days Won

    1

TheOne23 last won the day on July 1 2020

TheOne23 had the most liked content!

1 Follower

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TheOne23's Achievements

Adventurer

Adventurer (3/7)

7

Reputation

  1. Hi everyone, I would like to seek your help why sometimes the code or script I am running exits after _WD_FindElement successfully receives a correct element ID. here is the code: _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, '/html/body/div[4]/div/div[3]/div/div[3]/div/frame-router/iframe',2000,Default,Default,Default,Default) $iFrame_val = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath,'/html/body/div[4]/div/div[3]/div/div[3]/div/frame-router/iframe') ;~ ConsoleWrite("outside Frame") If $iFrame_val = "" Then ConsoleWrite("Inside the Frame - failed") do sleep(1000) _WD_WaitElement($sSession, $_WD_LOCATOR_ByXPath, '/html/body/div[4]/div/div[3]/div/div[3]/div/frame-router/iframe',5000,Default,Default,Default,Default) local $iFrame_val = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '/html/body/div[4]/div/div[3]/div/div[3]/div/frame-router/iframe') ;~ ConsoleWrite("Frame not yet found") until $iFrame_val <> "" Here is the logs on the console where you can see it exits. __WD_Post: URL=HTTP://127.0.0.1:9515/session/77c1fb1b03252c172093747689f3a1b2/element; $sData={"using":"xpath","value":"/html/body/div[4]/div/div[3]/div/div[3]/div/frame-router/iframe"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"f.F1B254D330E71164B196301418F2A157.d.22B7D63D185732... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"f.F1B254D330E71164B196301418F2A157.d.22B7D63D18573297274CDAACC74BAEAA.e.70"}} _WD_WaitElement ==> Success __WD_Post: URL=HTTP://127.0.0.1:9515/session/77c1fb1b03252c172093747689f3a1b2/element; $sData={"using":"xpath","value":"/html/body/div[4]/div/div[3]/div/div[3]/div/frame-router/iframe"} __WD_Post: StatusCode=200; ResponseText={"value":{"element-6066-11e4-a52e-4f735466cecf":"f.F1B254D330E71164B196301418F2A157.d.22B7D63D185732... _WD_FindElement: {"value":{"element-6066-11e4-a52e-4f735466cecf":"f.F1B254D330E71164B196301418F2A157.d.22B7D63D18573297274CDAACC74BAEAA.e.70"}} >Exit code: 0 Time: 94.61
  2. Hi MLipok, My main concern or problem here was already resolved. Below is the solution. local $ohandle = _WD_Window($sSession,"handles") ;~ _ArrayDisplay($ohandle) local $win2 = _WD_Window($sSession, 'switch', '{"handle":"'& $ohandle[1] &'"}') The intention here is to connect to the handle that was created by the webpage where it is not created by the script. The new tab here is not intentionally created by the script but it was created by the javascript of the webpage I am accessing. With the use of the function _WD_Window to search a handle and switch to it, this solved the issue I am facing. Posted August 2 I already confirmed that my inquiry was resolved. I guess the other question was created by Champak.
  3. Hi Champak, That is possible as long as you can manipulate the flow of the process. You can do a logic that it will sleep for some few seconds until the element is found before you will proceed with next step. But if the page that you will open shall remain open then it will cause a huge memory usage that may result to hang-up of your machine.
  4. Thank you very much @Danp2. Below is now my script that solved the issue. Thank you very much on the logic. You are the Man! 👍 local $ohandle = _WD_Window($sSession,"handles") ;~ _ArrayDisplay($ohandle) local $win2 = _WD_Window($sSession, 'switch', '{"handle":"'& $ohandle[1] &'"}')
  5. @Danp2 - Hi Sir Maybe you have some inputs from your end. 🙂
  6. Hi pixelsearch and Mikell, Thank you very much on your inputs. It is now solved. 👍
  7. Hi Web Driver AutoIT experts, I would like to ask your kind help if we have something similar to python's script of switching from main browser to another tab browser and apply the web scraping on that session. I tried below but seems like I am missing something. local $ohandle = _WD_Window($sSession,"handles") Python Script that I would like to have same functionality with AutoIT. browser.switch_to.window(browser.window_handles[1]) Appreciate for our inputs on this request. Thank you
  8. Hi Guys, Can you help me figure out why my test script is not working? it is showing "0" which is not match where I tried to put same value of string already. It worked when it is not in a variable format. Example: This works - StringRegExp($short_description_text_1,'(po)(?!.*\1\b)',$STR_REGEXPMATCH) This does not work - StringRegExp($short_description_text_1,$string,$STR_REGEXPMATCH) #include <MsgBoxConstants.au3> #include <StringConstants.au3> local $short_description_text_1 = "po" local $keywords_split_2 = "po" local $string = "'("& $keywords_split_2 &")(?!.*\1\b)'" ;~ MsgBox(0,"",$string) ;~ MsgBox(0,"result: ",StringRegExp($short_description_text_1, "'(" & $keywords_split_2 & ")(?!.*\1\b)'" ,$STR_REGEXPMATCH)) MsgBox(0,"result: ",StringRegExp($short_description_text_1,$string,$STR_REGEXPMATCH))
  9. Hi @mistersquirrle, I already tested it and works like a charm 🤩. Thanks very much brother!
  10. Hi @mistersquirrle, You're absolutely right mistersquirrle. That is what I would like to do. Thank you for your inputs. I will try it and will get back and hoping it will work and will update here the good news 🤩
  11. Hi @Danyfirex, Yes your right. Do you have any idea how to convert the 2nd snippet to fit on the $req variable in the 1st snippet?
  12. Hi @Danp2, I am trying to convert the 2nd snippet for the 1st snippet $req variable where the request variable will contain the 2nd snippet to I can get the output coming out of the 2nd snippet. The 2nd snippet it the body of the request where I have hard time how to incorporate it in AutoIT code in my 1st snippet.
  13. Hi Everyone / Json Masters, May I seek your assistance to help me with my code. My code is able to login and get bearer token but I am unable to make a working string representation of the Json raw data to my script. My script doesn't give any errors but blank response. The second snippet is the Json raw data where I am trying to convert to a string to be called as a request to be able to get a proper response / output. _GetToken() ;~ MsgBox(0,"",$sU_Token) $sBaseurl2 = $url $oHttp = Objcreate("winhttp.winhttprequest.5.1") $oHttp.open("POST", $sBaseurl2, False) $oHttp.SetRequestHeader("Content-Type","application/json") $oHttp.SetRequestHeader("Authorization", "Bearer " & $sU_Token) $oHttp.SetRequestHeader("Accept","application/json") $req = '{busObId: 6dd53665c0c24cab86870a21cf6434ae,&Fields: [6ae282c55e8e4266ae66ffc070c17fa3],&filters: [{fieldId: 9365a6098398ff2551e1c14dd398c466d5a201a9c7,&operator: equals,&value: Incident}]}]}' ;~ $oHttp.Option(4) = 0x3300 $oHttp.Send($req) $oReceived = $oHttp.ResponseText $oStatus = $oHttp.Status $sCanisterVal = $oReceived Consolewrite ($oReceived) { "busObId": "6dd53665c0c24cab86870a21cf6434ae", //Incident Business Object ID //Fields Return "Fields": [ "6ae282c55e8e4266ae66ffc070c17fa3" //Ticket ID ], "filters": [ { "fieldId": "9365a6098398ff2551e1c14dd398c466d5a201a9c7", //Incident Type "operator": "equals", "value": "Incident" }, { "fieldId": "83c36313e97b4e6b9028aff3b401b71c", //Priority "operator": "equals", "value": "1" }, //Status { "fieldId": "5eb3234ae1344c64a19819eda437f18d", //Status "operator": "equals", "value": "New" }, { "fieldId": "5eb3234ae1344c64a19819eda437f18d", //Status "operator": "equals", "value": "Assigned" }, { "fieldId": "5eb3234ae1344c64a19819eda437f18d", //Status "operator": "equals", "value": "In Progress" }, { "fieldId": "5eb3234ae1344c64a19819eda437f18d", //Status "operator": "equals", "value": "Pending" }, { "fieldId": "5eb3234ae1344c64a19819eda437f18d", //Status "operator": "equals", "value": "Reopened" } ] }
  14. Hi Melba23, I see. Thank you for the updates and response. By the way, do you have anything I can use to connect to an API where I have the following information from the other developer team I am connecting with. 1.) ClientID 2.) Payload 3.) url for the token 4.) username and password 5.) API link
  15. Hi billou95, Do you have a sample of the full code for this basic auth on rest api?
×
×
  • Create New...