Jump to content

WebDriver UDF - Help & Support


Recommended Posts

@rlvitorino Starting  from ChromeDriver version 76, disable-infobars flag was officially deprecated. I solved the problem by changing the capabilities as follows: 

$sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "ignore", "goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, "args": ["start-maximized"] }}}}'

Reference : https://stackoverflow.com/questions/57298901/unable-to-hide-chrome-is-being-controlled-by-automated-software-infobar-within

Edited by CYCho
Link to comment
Share on other sites

Func _jsEval($jsFile, $jsFun)
    Local $Ret = ""
    Local $jss = FileRead($jsFile)
    Local $mss = ObjCreate("MSScriptControl.ScriptControl")
    With $mss
        .language = "JavaScript"
        .addcode($jss)
        $Ret = .eval($jsFun)
    EndWith
    Return $Ret
EndFunc

As above,

by introducing the javascript script file,

That can execute the function of the script file .

_ WD_ExecuteScript what to do if want to achieve this effect?

For example, there is the following javascript file:

<script>
function switchTo(Page) {
    window.location.href="https://www.autoitscript.com/forum/topic/192730-webdriver-udf-help-support/page/" + Page + "/";
}
</script>

how do I introduce the script function and execute it?

Edited by Letraindusoir
Link to comment
Share on other sites

46 minutes ago, Danp2 said:

@Letraindusoir Have you taken a look at the _WD_jQuerify function in wd_helper.au3?

Thank you Danp2!

because there are no relevant examples, I did not see it very clearly.

Is it used to introduce

https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js

files?

What if I want to introduce a local js file and execute the functions in it properly? 

Link to comment
Share on other sites

Has anyone come up with proper wordings of $sDesiredCapabilities to disable "save password" bubble? I tried "prefs": ["credentials_enable_service": false], but chromedriver would not start with this option included.

Solved - prefs option takes a dictionary type, so curly braces should be used to enclose the parameters: "prefs": {"credentials_enable_service": false}

Edited by CYCho
Link to comment
Share on other sites

16 hours ago, Danp2 said:

I can't imagine that it would be too difficult to write a generic function that accepts an additional parameter to indicate the script that needs to be injected.

If it is not possible, the mixed use of "MSScriptControl.ScriptControl" estimates can also achieve the goal.

 

Link to comment
Share on other sites

In the process of using webdriver to manipulate the web page,

two small problems are found:

1, when the page or browser in operation is closed for some reason,

    the code is still executing and does not automatically terminate with the loss of focus or target.

2. When the code execution is terminated for unexpected reasons,

   the error warning pop-up window appears when the browser is opened again (warning closed improperly).

   How do I automatically close this pop-up window?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...