Jump to content

Recommended Posts

Posted (edited)

After many hours trying to setup a private proxy, i've found a decent workaround and implemented it in AutoIt, ideas based on 

6 hours ago, mLipok said:

@Danp2 could you take a look on this solution: https://stackoverflow.com/a/55582859/5314940

I'm not so good in this kind of things.

  1. Just make an unpacked extension folder contains manifest.json and background.js, file templates are provided in the answer of the above stackoverflow question. By doing this you will expose your private proxy to those who access to these files.
  2. Add an extra chrome switch --load-extension and its value will be the path to the unpacked extension folder (both using _WD_Option or set $sCapabilities will do)
_WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log" --load-extension=path\\to\\unpacked\\folder')

Or

{
    "capabilities": {
        "alwaysMatch": {
            "goog:chromeOptions": {
                "args": [
                    "--load-extension=path\\to\\unpacked\\folder"
                ]
            }
        }
    }
}

Notice that the manifest.json is using some functions from v2 and will soon be deprecated in Jan 2023. I've attempted to migrate it to v3 but failed due to this known chromium bug.

Edited by sylremo
Posted (edited)
On 3/7/2022 at 2:31 PM, mLipok said:

Starting review and investigation.

Sorry for my late ;)

Fix is on the way, I just pushed PR on github.
 

@carparso from where you get this following examples?
I suppose that maybe from wiki or some of my examples - I want to check and change them.

On 3/7/2022 at 2:17 PM, carparso said:

       Local $a= SetupEdge(False)
       _WD_Startup()
       $sSession = _WD_CreateSession($a)

    Func SetupEdge($bHeadless)
        _WD_Option('Driver', 'msedgedriver.exe')
        _WD_Option('Port', 9515)
        _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\msedge.log"')
    
    ;~     Local $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"ms:edgeOptions": {"excludeSwitches": [ "enable-automation"]}}}}'
        _WD_CapabilitiesStartup()
        _WD_CapabilitiesAdd('alwaysMatch', 'edge')

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted (edited)

Hi, im currently in a really awkward situation. I slightly modified WinHttp.au3 to resolve personal issues,  my script works fine with modified version but the compiled version doesn't (both are in the same working dir). Then i tried to use Au3Stripper to see whats going on inside the stripped script and i realized that all WinHttp functions are being magically reverted to the initial state, i even take it seriously by empty the whole function but it still behaves the same way. Really weird and im so confused rightnow. I ensured that all the #include were set to the correct path.

In the case below, au3 version will immediately throw error to indicate that _WinHttpCrackUrl is not doing its job but the compiled version will work like nothing happened.

image.thumb.png.4ff7ed4a85748989c71a00b5866a193f.png

Edited by sylremo
Posted

@Danp2
Unfortunately, using SciTe make no differences, all files are located in AutoIt Include folder, except for my main script changeproxy.au3.

Spoiler

image.thumb.png.13e0f7ace87639c1e47ed98cbc0df1e5.png

And here is the original script compared to the stripped version.

Spoiler

image.thumb.png.021676050ff14f29b1728f131f2f4536.png

 

Posted (edited)

@danp2, i tried to completely uninstall and remove autoit program files folder, restart my pc, reinstall but nothing helps.

Edit: welp, after many attempts, i finally managed to fix this issue by renaming WinHttp.au3 ... 

Edited by sylremo
fixed
Posted (edited)

@Danp2, yes i shouldn't be discuss this problem here but still i did... I thought it would be a good idea to post here and get quick responses since this topic might be the most active place on the entire autoit forum. I'll try my best to avoid degression. Again, i appreciated your valuable time.

Edited by sylremo
Posted

Hi, thanks for the open source, it helped me a lot. But now I encounter a problem. When using _WD_FindElement to locate a button in the page, if the button can only be seen after dragging through the scroll bar, then clicking the button will return a failure message. Is there any solution?

image.thumb.png.87eaf05005b4ef0d6ee85f688c5599b9.png

Posted (edited)

Hi @liamashes,

like @Danp2 already mentioned, the scroll action to your element should be done automatically. But this sometimes depends on the page and DOM structure.
Dealing with Angular/React with "shadow DOM" behaves differently then other (older web frameworks) without "shadow DOM" for example.

That's why Selenium as a example provides a method .MoveToElement to do something like a hover over the element which triggers the scroll action.
Maybe you find a similar approach for your requirement or you just focus the browser window by AutoIt (WinActivate()) and Send('{PGUP}') or Send('{PGDN}') to bring your element into the viewport.

In case this wouldn't help, please provide a DOM snippet and more details/screenshots etc., thanks.

Best regards
Sven

________________
Stay innovative!

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)

Posted

@Danp2Both buttons and input boxes have this problem. Here is the behavior of simulating user login, you need to enter the user name and password. This log is the result of trying to get the input box and enter the user name. The browser does not scroll the page, but prompts that the interaction cannot be performed.
The scenario mentioned above can be avoided by maximizing the window, but for buttons and input boxes that need to be scrolled to be seen in the page, the scrolling operation seems to be unavoidable.Is this problem related to the framework used for page development?

Posted

@SOLVE-SMART@Danp2Thanks for your replies, I only saw this after reading the previous reply.
@SOLVE-SMARTAs you said, the page here is developed using Angular, a very old framework. This is a commercial internal website, so it is not convenient to take screenshots.

I don't know much about automated testing. The solution I can think of is to calculate the step size and scale according to the width of the scroll bar and the total width of the window. According to the scale, combine the position of the target element in the window to calculate the coordinates, and then drag the scroll bar to the corresponding position. coordinates, but this scheme is cumbersome.
Will there be a solution to this problem in the future?

Also, thanks for the implementation of webdriver you guys provided, it helped me a lot😁

Posted

Hi guys! currently i want to add proxy to my specified browser however it is not working. can you show me the error in my syntax.
here is my code:   

    $exe='C:\Users\Administrator\Chrome\browser\chrome.exe'
    $exe=StringReplace($exe,'\','\\')
    $profile=@ScriptDir&'\Chrome\Data\profile\'
    $profile=StringReplace($profile,'\','\\')
$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true},    "binary":"'&$exe&'"    ,"args":["--user-data-dir='&$profile&'", "--profile-directory=Default"],"proxy":{"proxyType":"manual","httpProxy":"119.98.114.154:6003","autodetect": "false"}}}'

Posted

Use code tags when you post code. Post console error messages.

Take a look few post back, we was discuss the same things, and there are examples.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted
32 minutes ago, mLipok said:

Use code tags when you post code. Post console error messages.

Take a look few post back, we was discuss the same things, and there are examples.

#include "driver\wd_core.au3"
    #include "driver\wd_helper.au3"

    _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Startup()
    $exe='C:\Users\Administrator\Chrome\browser\chrome.exe'
    $exe=StringReplace($exe,'\','\\')
    $profile=@ScriptDir&'\Chrome\Data\profile\'
    $profile=StringReplace($profile,'\','\\')
$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true},    "binary":"'&$exe&'"    ,"args":["--user-data-dir='&$profile&'", "--profile-directory=Default"],"proxy":{"proxyType":"manual","httpProxy":"119.98.114.154:6003","autodetect": "false"}}}'

                    $sSession=_WD_CreateSession($sDesiredCapabilities)
                    _WD_Navigate($sSession,'https://www.google.com.vn/?hl=vi')
                    _WD_LoadWait($sSession)


                    _WD_DeleteSession($sSession)
                    _WD_Shutdown()

here is my code and the error report is as follows:
__WD_Post: StatusCode=400; ResponseText={"value":{"error":"invalid argument","message":"invalid argument: missing command parameters","stack...
__WD_Post ==> Invalid argument: {"value":{"error":"invalid argument","message":"invalid argument: missing command 

I lost a lot of time and don't know how to set the proxy parameter properly. hope you can fix it

 

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...