Jump to content

WebDriver UDF - Help & Support (IV)


Recommended Posts

41 minutes ago, samibb said:

@Danp2 

I am using Cryptic Window so i need after i send the command press 'ENTER' to prosed it.

Thanks

Do not know what "Cryptic Window" is but...

Most of udf-s are made so that they set @error macro to some value if their function fail, so if you cant reproduce sample script for us to test, take some time and debug where error is, look at function description from udf for more info to see witch error is, if any is represented in function description and then debug your code...

if @error Then ConsoleWrite...

 

Additional note, if your using on normal browser AD blocker, or site have accept cookies option, it can happened that your path from headless and normal browser are two different things so that element xpath location is just wrong.

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

When I print webpage to PDF then I get PDF with embeded fonts:

image.png.8b7adfd82512580b1f0609dd87188aef.png

 

I need to generate PDF with desired font to have standard Windows Font which are not needed to be embeded to the PDF.

The reason is PDF file size with embeded Font it always is greater then 150KBytes even if it has no images only about 50 words.

Any idea how to use different font in web page in the way to produce PDF via WebDriver with disered font ?

 

EDIT:
some findings:

https://bugs.chromium.org/p/chromium/issues/detail?id=99125

https://courtneyzhan.medium.com/print-style-sheets-and-export-a-webpage-to-pdf-in-selenium-webdriver-c302ddca996d

https://www.w3schools.com/css/css_font.asp

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

Link to comment
Share on other sites

btw.

https://bugs.chromium.org/p/chromedriver/issues/detail?id=3517

Is it really fixed ?
Can somebody print to PDF with non headles in Chrome ?

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

Link to comment
Share on other sites

from normal chrome 116.0.5845.111 x64 (smaller coz probably adblock remove something from page :))

3517 - Enable print feature for non-headless - chromedriver.pdf

from chromedriver 116.0.5845.96 x64 (runed on website with py, added sleep 1000 seconds, used ctrl+p for printing)

3517 - Enable print feature for non-headless - chromedriver1.pdf

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

On 8/24/2023 at 9:27 AM, samibb said:

How can I press 'ENTER' IN CHROME 

You asked the above. I responded by pointing you to a prior post that shows how to do what you requested. It doesn't sound like you even read the post, so maybe you missed the link that was embedded in my reply. Here it is again to be sure -- https://www.autoitscript.com/forum/topic/201106-webdriver-udf-help-support-ii/page/37/#comment-1463407

Edit: Also, it appears that you are using an outdated version of the UDF

Edited by Danp2
Link to comment
Share on other sites

Local $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"browserName": "chrome"}}}'
;SetupChrome()
;_WD_Startup()
Local $sessionId = _WD_CreateSession($sDesiredCapabilities)
MsgBox(0,0,$sessionId)
_WD_Navigate($sessionId, "https://saudiairlines-my.sharepoint.com/:f:/g/personal/sbahwal_saudia_com/EnsNv1MZOuhPgNznypp1IpMBmHGCcC6JEdlhF1TgyOm09g?e=JfVVjK")

Local $fileInput = _WD_FindElement($sessionId, $_WD_LOCATOR_ByXPath, "//input[@type='file']")
MsgBox(0,0,$fileInput)
_WD_ElementAction($sessionId, $fileInput, 'sendKeys', 'C:\Users\11003813\Desktop\REFUND\LIST.txt')

======================================================================================================
__WD_Post ==> Success [0] : HTTP status = 404
_WD_CreateSession ==> Webdriver Exception [10]
__WD_Post ==> Success [0] : HTTP status = 404
_WD_Navigate ==> Success [0] : Parameters:   URL=https://saudiairlines-my.sharepoint.com/:f:/g/personal/sami_com/EnsNv1MZOuhPgNznypp1IpMBmHGCcC6JEdlhF1TgyOm09g?e=JfVVjK
__WD_Post ==> Success [0] : HTTP status = 404
_WD_FindElement ==> Success [0] : Parameters:   Strategy=xpath   Selector=//input[@type='file']   StartNodeID=Default   Multiple=Default   ShadowRoot=Default
_WD_ElementAction ==> Invalid data type [3] : (Active|Attribute|ComputedRole|ComputedLabel|Clear|Click|CSS|Displayed|Enabled|Name|Property|Rect|Selected|Shadow|Screenshot|Text|Value) $sCommand=>sendkeys

 

This code for copy file from pc. to share folder in OneDrive last step not valid.

 

need your help as usual Thanks

Link to comment
Share on other sites

9 minutes ago, samibb said:
_WD_CreateSession ==> Webdriver Exception [10]

You need to figure out why this command is failing.

Other issues --

  • Take a look at _WD_SelectFiles in the help file. This command is intended to work on your target element.
  • Look at the help file entry for _WD_ElementAction for the valid actions, which you should note that "sendKeys" isn't one of them

P.S. You really can't expect us to debug your script for you. Please get in the habit of reviewing your own logs to determine which commands are failing so that you can better troubleshoot your own scripts.

Link to comment
Share on other sites

@_leo_ If you want input from others,  then I suggest that you share additional details regarding your setup. For example -

  • Are you sure that you are using the latest version of this udf?
  • Which browser? Browser version?
  • Which webdriver? Version?

Can you provide a short script that demonstrates the problem? Are you able to run wd_demo successfully?

Link to comment
Share on other sites

  • Moderators

Hi,

At the request of Danp2 this thread is now closed. Future questions on WebDriver should be posted as specific threads in the General Help and Support Forum.

M23

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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