Задать вопрос
  • Selenium. Как настроить прокси или VPN в любом браузере?

    @IvanSstarr
    Вот так это пишется на Powershell, а на Python все аналогично:

    add-type -path "C:\Program Files\WindowsPowerShell\Modules\Selenium\1.1\assemblies\WebDriver.dll"
    $options = New-Object OpenQA.Selenium.Chrome.ChromeOptions
    $options.addArguments("proxy-server=5.196.132.124:3128")
    $driver = New-Object OpenQA.Selenium.Chrome.ChromeDriver($options)
    $Driver.Navigate().GoToUrl("https://2ip.ru/")

    Проверено работает.
    Ответ написан
    Комментировать
  • Сравнение объектов Powershell+Selenium+Chrome и Powershell+IE, почему такая огромная разница?

    @IvanSstarr Автор вопроса
    Написал функцию (костыль), проблема частично решена

    function get-all-attribute-web-SE-elements($web_element){
    $attributs = "className","id","tagName","parentElement","style","onhelp","onclick","ondblclick","onkeydown","onkeyup","onkeypress","onmouseout","onmouseover","onmousemove","onmousedown","onmouseup","document","title","language","onselectstart","sourceIndex","recordNumber","lang","offsetLeft","offsetTop","offsetWidth","offsetHeight","offsetParent","innerHTML","innerText","outerHTML","outerText","parentTextEdit","isTextEdit","filters","ondragstart","onbeforeupdate","onafterupdate","onerrorupdate","onrowexit","onrowenter","ondatasetchanged","ondataavailable","ondatasetcomplete","onfilterchange","children","all","scopeName","onlosecapture","onscroll","ondrag","ondragend","ondragenter","ondragover","ondragleave","ondrop","onbeforecut","oncut","onbeforecopy","oncopy","onbeforepaste","onpaste","currentStyle","onpropertychange","tabIndex","accessKey","onblur","onfocus","onresize","clientHeight","clientWidth","clientTop","clientLeft","readyState","onreadystatechange","onrowsdelete","onrowsinserted","oncellchange","dir","scrollHeight","scrollWidth","scrollTop","scrollLeft","oncontextmenu","canHaveChildren","runtimeStyle","behaviorUrns","tagUrn","onbeforeeditfocus","isMultiLine","canHaveHTML","onlayoutcomplete","onpage","onbeforedeactivate","contentEditable","isContentEditable","hideFocus","disabled","isDisabled","onmove","oncontrolselect","onresizestart","onresizeend","onmovestart","onmoveend","onmouseenter","onmouseleave","onactivate","ondeactivate","onmousewheel","onbeforeactivate","onfocusin","onfocusout","uniqueNumber","uniqueID","nodeType","parentNode","childNodes","attributes","nodeName","nodeValue","firstChild","lastChild","previousSibling","nextSibling","ownerDocument","prefix","localName","namespaceURI","textContent","dataFld","dataSrc","dataFormatAs","role","ariaBusy","ariaChecked","ariaDisabled","ariaExpanded","ariaHaspopup","ariaHidden","ariaInvalid","ariaMultiselectable","ariaPressed","ariaReadonly","ariaRequired","ariaSecret","ariaSelected","ie8_attributes","ariaValuenow","ariaPosinset","ariaSetsize","ariaLevel","ariaValuemin","ariaValuemax","ariaControls","ariaDescribedby","ariaFlowto","ariaLabelledby","ariaActivedescendant","ariaOwns","ariaLive","ariaRelevant","ie9_tagName","ie9_nodeName","onabort","oncanplay","oncanplaythrough","onchange","ondurationchange","onemptied","onended","onerror","oninput","onload","onloadeddata","onloadedmetadata","onloadstart","onpause","onplay","onplaying","onprogress","onratechange","onreset","onseeked","onseeking","onselect","onstalled","onsubmit","onsuspend","ontimeupdate","onvolumechange","onwaiting","constructor","onmspointerdown","onmspointermove","onmspointerup","onmspointerover","onmspointerout","onmspointercancel","onmspointerhover","onmslostpointercapture","onmsgotpointercapture","onmsgesturestart","onmsgesturechange","onmsgestureend","onmsgesturehold","onmsgesturetap","onmsgesturedoubletap","onmsinertiastart","onmstransitionstart","onmstransitionend","onmsanimationstart","onmsanimationend","onmsanimationiteration","oninvalid","xmsAcceleratorKey","spellcheck","onmsmanipulationstatechanged","oncuechange","type","value","name","status","form","ie9_type"
    for ($a = 0;$a -lt $attributs.Count; $a++){
    if($web_element.GetAttribute($attributs[$a].Split(":")[0].TrimEnd(" ")).Length -gt 0){
    Write-Host $attributs[$a].PadRight(28, " ") ": " $web_element.GetAttribute($attributs[$a].Split(":")[0].TrimEnd(" "))
    }}}

    Запускаем функцию:
    get-all-attribute-web-SE-elements ($Driver.FindElementsByClassName("button")[1])

    Получаем:
    5c6d16ba25272859875608.jpeg
    Ответ написан
    Комментировать
  • Как в Selenium запускать браузер с расширениями?

    @IvanSstarr
    Вот тут обсуждали подобную тему:
    qaru.site/questions/1587137/how-to-select-chrome-e...
    Но как сделать тоже самое с помощью powershell?
    Ответ написан
    Комментировать
  • Powershell+Selenium. Как открыть новую вкладку при клике?

    @IvanSstarr
    Можно сначала получить ссылку из элемента по которому хотим кликнуть, а потом подставить сюда:
    $ie.executeScript("window.open('yandex.ru', '_blank')")
    Ответ написан
    Комментировать
  • Powershell+Selenium. Как закрыть вкладку?

    @IvanSstarr
    $ie.SwitchTo().window($ieWindowHandles[-1]).Close()
    Ответ написан
    Комментировать