Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/24/2024 in all areas

  1. I hope the following listed people, you guys 😇 , will also take part on this poll regarding WebDriver 🤞 🤝 . I saw in other Threads regarding WebDriver that you are involved in browser automation. Or at least you asked for help regarding WebDriver - that's why you are listed here now. Simply see the poll above 👆 , thanks. Please take part 🙏 : @argumentum ✅ @bdr529 ✅ @Blaxxun @MarcoMonte ✅ @SEKOMD ✅️ @tac7 @Keras Best regards Sven
    1 point
  2. Using the script in your original post, I got the same result as you. However, I get a valid response when using an acceptable user agent string. What's an acceptable user agent string and how a website handles requests & responses based on the user-agent string, is up to the web site developer/administrator. Change: $hInternet = _WinHttpOpen() to $hInternet = _WinHttpOpen("curl")
    1 point
  3. You can probably increase the maximum number of characters if you really use POST instead of a disguised GET. The return limit here seems to be 65,535 characters. As an example: #include "Json.au3" #include <String.au3> ; build long string $sText = _StringRepeat("Wie geht`s? ", 2^16 / 12) ConsoleWrite("string length: " & StringLen($sText) & @CRLF) ; translate the string $sTranslated = _GoogleAPITranslate($sText , "de", "en") ConsoleWrite("return length: " & StringLen($sTranslated) & @CRLF & @CRLF) ConsoleWrite($sTranslated & @CRLF) Func _GoogleAPITranslate($sMytext, $sFrom, $sTo) ; format and send request Local $sResponse With ObjCreate("winhttp.winhttprequest.5.1") .Open("POST", "https://translate.googleapis.com/translate_a/single", False) .SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") .Send(StringFormat("client=gtx&sl=%s&tl=%s&dt=t&q=%s", $sFrom, $sTo, _URIEncode($sText))) $sResponse = .ResponseText EndWith Local $vResponse = _JSON_Parse($sResponse) ; process return Local $aData, $sOutput = "" If VarGetType($vResponse) = 'Array' Then $aData = $vResponse[0] If VarGetType($aData) = 'Array' Then For $i = 0 To UBound($aData) -1 $sOutput &= ($aData[$i])[0] Next EndIf EndIf Return $sOutput EndFunc Func _URIEncode($sData) ; Prog@ndy Local $aData = StringSplit(BinaryToString(StringToBinary($sData, 4), 1), "") Local $nChar $sData = "" For $i = 1 To $aData[0] $nChar = Asc($aData[$i]) Switch $nChar Case 45, 46, 48 To 57, 65 To 90, 95, 97 To 122, 126 $sData &= $aData[$i] Case 32 $sData &= "+" Case Else $sData &= "%" & Hex($nChar, 2) EndSwitch Next Return $sData EndFunc ;==>_URIEncode
    1 point
  4. Roboto Mono works well for me, but I'm not too picky...
    1 point
  5. In case of emergency, use the link [ DejaVu Sans Mono from github ]
    1 point
  6. I too find life too hard without DejaVu Sans Mono.
    1 point
  7. Hi @argumentum 👋 , your page do not have any @ids in the DOM available (at least for the /LoginForm/ page. So you have to search for indicators which will give you the correct elements to interact with. In this example page you could use the placeholder attribute for username and password and the name "Login" for the submit button as your selectors. In other words, you can use XPath for the three elements to interact (2x input, 1x button) like this: _Login() Func _Login() Local Const $sUsername = 'argumentum' Local Const $sPassword = 'your-password' Local Const $sUsernameSelector = '//form//input[@placeholder="Enter Username"]' ; or by name: [@name="uname"] Local Const $sPasswordSelector = '//form//input[@placeholder="Enter Password"]' ; or by name: [@name="psw"] Local Const $sSubmitButtonSelector = '//form//button[text()="Login"]' _WD_ElementAction($sSession, _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sUsernameSelector), 'value', $sUsername) _WD_ElementAction($sSession, _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sPasswordSelector), 'value', $sPassword) _WD_ElementAction($sSession, _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, $sSubmitButtonSelector), 'click') EndFunc I didn't tested it right now, but I am relatively sure, this should work 😇 . How did I came up with the XPath? Okay, I am experienced with locator strategies, but in case you're not: Use Chrome (or Firefox) > right click on your target element > choose "inspect" > you are now in the DevTools ("Elements" tab) > right click on the highlighted DOM element (input or button) > choose Copy from the context menu > Copy XPath > Ctrl+F > paste your generated XPath in the search (optional) > this verifies the match > use this selector in the _WD_FindElement() function. But: This is often not very robust. It's usually better to improve the selector by the usage of a relative XPath (different XPath Axes). I hope this will answer your questions 🤞 . Best regards Sven
    1 point
  8. The problem is that the image is semi-transparent and thus it looks good on white background. If you change the bg to black the result is the same as in your code. I don't have an idee yet how to display it with white bg but in a transparent GUI. Edit: If your bg is light then you can use: While Sleep(10) _GDIPlus_GraphicsClear($hBackbuffer, 0) ; Clear with opaque black color _GDIPlus_MatrixRotate($hMatrix, $iAngle, "False") _GDIPlus_GraphicsSetTransform($hBackbuffer, $hMatrix) _GDIPlus_GraphicsDrawImageRect($hBackbuffer, $hBG_Bitmap, -$rot_mid_x / 2, -$rot_mid_y / 2, $width / 2, $height / 2) $GDIBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap, 0xFFFFFFFF) _WinAPI_SelectObject($dc, $GDIBitmap) _WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0xFFFFFFFF, $pBlend, 1) _WinAPI_DeleteObject($GDIBitmap) WEnd which will add white as a bg color.
    1 point
  9. Sorry I'm late here, but if you want a specific resource then pretty much anything by this guy is fantastic: https://www.udemy.com/user/maximilian-schwarzmuller/, maybe this course would suit you: https://www.udemy.com/course/javascript-the-complete-guide-2020-beginner-advanced/. (Incidentally the pricing on Udemy is very weird, one day a course may be £110, the next it may be £15, so just hold off until the price goes down, not sure if the prices are linked to your interests on your account)
    1 point
  10. Danp2

    WebDriver + SingleFile

    FWIW, this appears to be the extension ID for FF, not Chrome. The correct one AFAICS is "mpiodijhokgodhhofbcjdecpffjipkle". Based upon what I found here, I would have thought that the following would trigger it. chrome.runtime.sendMessage('mpiodijhokgodhhofbcjdecpffjipkle', "save-page") Unfortunately, no such luck. No errors, but no saved file AFAICS.
    0 points
×
×
  • Create New...