Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with findElementById method #37

Open
GoogleCodeExporter opened this issue Apr 3, 2015 · 3 comments
Open

Problem with findElementById method #37

GoogleCodeExporter opened this issue Apr 3, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

Operating system and version (32/64bit) : XP SP3 (32bit)
.Net Framework version :
Office name and version(32/64bit) :
Browser name and version : Firefox 26
SeleniumWrapper version : 1.0.17.0

First, I would like to thank you for SeleniumWrapper. It is excellent tool !
1. Me tried to edit your QuickTest.vbs file in order to access text in input 
element but it doesnt work as me expected

Dim selenium, mytext
Set selenium = CreateObject("SeleniumWrapper.WebDriver")
......
' mytext = selenium.getValue("lst-ib")
mytext = selenium.findElementById("lst-ib").Text
wscript.echo "Searched for: " & mytext  
selenium.stop

What is the expected output? What do you see instead?
The empty string was returned by
 selenium.findElementById("lst-ib").Text

if i use mytext = selenium.getValue("lst-ib") it works and "Eiffel tower" is 
returned

2. I tried to use WebElement like this:
Dim selenium, element, mytext
Set selenium = CreateObject("SeleniumWrapper.WebDriver")
Set element = CreateObject("SeleniumWrapper.WebElement")
element = selenium.findElementById("lst-ib")
mytext = element.Text

it crashed with "ActiveX component can't create object 
"SeleniumWrapper.WebElement". 
BTW, i dont see SeleniumWrapper.WebElement entry in registry.

Could you please provide your expert opinion ?

Thanks in advance !


Original issue reported on code.google.com by alex.fir...@gmail.com on 29 Dec 2013 at 12:13

Attachments:

@GoogleCodeExporter
Copy link
Author

The text typed in an input is stored in the attribute named "value" and not as 
inner text (see by yourself the html source).
That's why there is no text returned in your case.
The equivalent to getValue("id") is findElementById("id").getAttribute("value").

Here is an example :
Set driver = CreateObject("SeleniumWrapper.WebDriver")
driver.start "firefox", "http://www.google.com"
driver.open "/"
driver.type "name=q", "Eiffel tower"
driver.keyPress "name=q", "\13"
wscript.echo driver.getValue("name=q")   'Selenium 1
wscript.echo driver.findElementByName("q").getAttribute("value")     'Selenium 2

Original comment by florentbr on 29 Dec 2013 at 1:11

  • Changed state: Accepted
  • Added labels: Type-Support
  • Removed labels: Type-Defect

@GoogleCodeExporter
Copy link
Author

findElementById("id").getAttribute("value") works ! Thank you !

Am i right - object SeleniumWrapper.WebElement is not registered ? Therefore  
Set element = CreateObject("SeleniumWrapper.WebElement")
is crashed with "ActiveX component can't create object 
"SeleniumWrapper.WebElement". 

Original comment by alex.fir...@gmail.com on 30 Dec 2013 at 8:38

Attachments:

@GoogleCodeExporter
Copy link
Author

Original comment by florentbr on 8 Sep 2014 at 5:40

  • Changed state: Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant