Getting attribute text from HTML using VBA selenium - vba

I need to get the value "8.37" from the "data-rating" attribute.
<div class="ch-rating"> "VERYGOOD 8.37"
<div class="star-rating star-rating--alt star-rating--ch" data-rating="8.37" style="">
<span style="width: 83.7%;"></span>
</div>
</div>
In java there is .getAttribute() but I can't find the syntax in VBA.
I guess its something like this:
bot.FindElementByXPath("//div[#data-rating]"). followed by some syntax.

To get the value "8.37" from the "data-rating" attribute you can use the following line of code :
bot.FindElementByXPath("//div[#class='ch-rating']/div[#class='star-rating star-rating--alt star-rating--ch']").getAttribute("data-rating")
Update 1
HtmlElement.GetAttribute Method (String)
Syntax :
var attribute = element.getAttribute(attributeName);
where
attribute is a string containing the value of attributeName.
attributeName is the name of the attribute whose value you want to get.
Update 2 :
As you are seeing Run-time error 438: Object doesn't support this property or method for HtmlElement.GetAttribute Method (String) here are some details :
Error 438 occurs when running a program in which a form is assigned to a variable and that variable is used to access a control on the form if the program is on a system running Windows 95 with Regional Settings set to a setting other than English (United States). The error text is:
Run-Time Error #438:
Object doesn't support this property or method
Resolution
There are two possible workarounds for this problem.
Access the form directly rather than by a variable containing the form.
Create property procedures in the form's code to provide access to the properties of the controls on the form.
Status
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem has been fixed in Windows 98.
Trivia
To reproduce this bug consistently, you will need HeapWalker, a utility that ships with the Windows 16-bit Software Development Kit and the 16-bit version of Visual C++.
Steps to Reproduce :
From Control Panel, click Regional Settings to open the Regional Settings dialog box. Set the Regional Settings to English (Australian).
Start the 16-bit edition of Visual Basic 4.0. If it is already running, select New Project from the File menu.
Source : FIX: Error 438"Object Doesn't Support This Property or Method"

Related

Error while exporting TXTextControl as PDFA or XML

i gain a strange error: 'This feature is not available in the TX Text Control Standard or Professional version. The TX Text Control Enterprise version must be installed.' when I try to save the TXTextControl object with .Save function in .pdfa, .xml and other formats. The error comes when I explicit the StreamType parameter in the .Save function. It seems I have not all the format offered by TXTextControl.
Error comes in this line for example:
TXTextControl.Save(dir, TXTextControl.StreamType.XMLFormat)
or
TXTextControl.Save(dir, TXTextControl.StreamType.AdobePDFA)
I searched online but I can't find references to this error and for TXTextControl enterprise or professional version.
There 's actually different versions of TXTextControl? How can I verify what version I have?
Thanks.
Using TXTextControl.GetVersionInfo().Level should tell you what level you have (as per ProductLevel property)
If you look at the Features page and open up the Supported Formats section under "Features in Detail" then you can see which formats your product level supports.

Customized cultures cannot be passed LCID, only by name, Parameter name: culture

I'm using crystal report in my VB.net application, when I show the Report and try to print it I face this error :
Customized cultures cannot be passed LCID, only by name, Parameter name: culture
The printing works fine on my computer but the problem on client computer.
this the error picture :
after searching, I found the solution :
By change the region settings of the operation system to a format whose LCID does not equal 4096. The format can be changed in Control Panel > Region > Formats.

XAML UWP Windows Store : error CS0266/warning CS1697 when deploying solution

I've some warning/error when trying to "create App Packages" from a XAML UWP project.
Firstly a warning :
2017\Projects\MyProjectName\MyProjectName\obj\x86\Release\MyPageName.g.cs(1,1,1,194): warning CS1697: Different checksum values given for C:\Users\administrateur\Documents\Visual Studio 2017\Projects\MyProjectName\MyProjectName\MyPageName.xaml
It seem there is a problem with space (the second path is beginning after the last space -before "2017"-). I'm on Win 10.
Ive an cast error too :
1>C:\Users\administrateur\Documents\Visual Studio 2017\Projects\MyProjectName\MyProjectName\obj\x86\Release\MyPageName.g.cs(39,36,39,85): error CS0266: Cannot implicitly convert type 'Windows.UI.Xaml.Controls.Button' to 'MyProjectName.MyButtonReturn'. An explicit conversion exists (are you missing a cast?)
MyButtonReturn is a button coded in a class extending Button, the definition of "MyButtonReturn" is :
public sealed class MyButtonReturn : Button
{...
Any help ?
Thanks
Found the solution, cleaning the solution + building the project on release worked.

Indexing queries in Railo

I went to the Web Administrator > Services > Search.
I manually create a collection with:
name "articoli"
path (a fake one, e.g. /tmp)
Italian language
Then in my indexer template:
<cfquery name="qry">
SELECT * FROM articoli
</cfquery>
<cfindex action="update"
collection="articoli"
key="artid"
type="custom"
title="artcod"
query="qry"
body="artdes" />
Result: collection articoli is undefined
Any ideas? Other ways for indexing with RAILO+Lucene?
EDIT:
I am using Railo 3.3 (old version). Is this kind of indexing available?
Checking the Railo source for v3.3 indicates that the error "collection articoli is undefined" will occur if the collection named doesn't exist - a simple search reveals only one instance of a "collection X is undefined" error message).
This suggests that either the name does not match what you typed into the web administrator, or that you created the articoli collection in a different web administrator to where you are running the code.

Crystal reports 11 RDC (COM API) displays printer dialog even when I tell it not to prompt

I'm using Crystal Reports 11's RDC (COM) API to print. My code looks like this:
HRESULT res = m_Report->SelectPrinter(b_driver, b_device, b_port);
if (FAILED(res)) return res;
// For these calls, the #import wrapper throws on error
m_Report->PutPrinterDuplex(dmDuplex);
m_Report->PutPaperSize(dmPaperSize);
m_Report->PutPaperSource((CRPaperSource)pdlg->GetDevMode()->dmDefaultSource);
if (m_Report->GetPaperOrientation() == crDefaultPaperOrientation)
m_Report->PutPaperOrientation(crPortrait);
VARIANT vfalse;
VariantInit(&vfalse);
vfalse.vt=VT_BOOL;
vfalse.boolVal=0;
res = m_Report->PrintOut(vfalse);
However, at the end of all this, crystal reports still shows its own printer selection dialog - but only for some reports, it seems. Why does crystal reports show a print dialog even when I pass false for promptUser? And how, then, can I suppress crystal reports' internal printer selection dialog and force it to use my values?
Edit: Whoops, CR11, not CR9.
Some further information:
The reports that work properly (ie, do not show the print dialog) are generated internally using the RDC API; we create a new report object, import subreports into it, then print the result. No problem there.
The reports that do not work properly (ie, force the print dialog to open) have been created with a previous version of crystal reports; however, opening and saving the report does not seem to help.
Sample reports in the Crystal Reports installation directory show the same problem.
I tried reproducing with VBScript; however, the result was that nothing was printed at all (no dialog, no nothing):
Set app = CreateObject("CrystalRuntime.Application.11")
Set report = app.OpenReport("C:\Program Files\Business Objects\Crystal Reports 11.5\Samples\en\Reports\General Business\Inventory Crosstab.rpt")
report.PrintOut(True)
rem Testing with a True parameter to force a print dialog - but no printout and nothing appears (no error either though)
First, let me preface that I'm not a C/C++ programmer, so I'm not able to test the code--my interaction w/ the SDK has been with the VB and .Net interface over the years.
I found the following code from BO's devlibrary:
// A dummy variant
VariantInit (&dummy);
dummy.vt = VT_EMPTY;
HRESULT hr = S_OK;
// Specify the path to the report you want to print
_bstr_t ReportPath("c:\\Program Files\\Business Objects\\Crystal Reports 11.5\\Samples\\En\\Reports\\General Business\\Inventory.rpt");
_variant_t vtEmpty(DISP_E_PARAMNOTFOUND, VT_ERROR);
// Instantiate the IApplication object
m_Application.CreateInstance("CrystalRuntime.Application.115");
//Open the Report using the OpenReport method
m_Report = m_Application->OpenReport(ReportPath, dummy)
//Print the Report to printer
m_Report->PrintOut(dummy, dummy, dummy, dummy);
Does it work? It should print the report with its 'default' printer settings and without prompting.
You wrote:
However, at the end of all this,
crystal reports still shows its own
printer selection dialog - but only
for some reports, it seems.
Generally speaking, I've found that Crystal tends to ignore commands to suppress dialogs if it thinks something is missing. I've found this to be true with the parameter dialog. Perhaps it apply to this situation as well. I would ask what is different about the reports that cause the dialog to be generated. There is a 'no printer' option that can be set. Perhaps this is the common thread.
Do you have access to the VB6 IDE? If you write the equivalent commands using VB6's interface, does the prompting occur?
You might also investigate using the CRPE32.dll instead of the report-designer control. To be honest, I don't know if the RDC wraps the CRPE DLL or is an entirely-separate code base.
Turns out it was a bug in my code after all - I'd previously put in a wrapper for the RDC API to fix certain other bugs we were having; due to the large number of methods in the IReport interfaces, I wrote a script to generate pass-through stubs for the methods I wasn't interested in. Turns out that script was passing in bogus values for parameters with default values. Oops! Fixing the wrapper code fixed the bug here.