### empty, class = xpop-content ### by.class [] [xpop-content] Screenshot: screenshots/1357682907182_8_no_rcpt_summary_1.png [shows text]### empty, class = xpop-content ### by.class [] [xpop-content] ### summaryTip class: xpop xtip size-medium useCloseBox xpop-position-bottom active
--To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/0n7rkJsaHqkJ.
You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.
### EXPT not got elt based on text.### EXPT elt not visible for click. ### EXPT not got txt based on click.### EXPT not got elt based on text.### EXPT elt not visible for click. ### EXPT not got txt based on click.### EXPT not got elt based on text.### EXPT elt not visible for click. ### EXPT not got txt based on click.### EXPT not got elt based on text.### EXPT elt not visible for click. ### EXPT not got txt based on click.### EXPT not got elt based on text.### EXPT elt not visible for click. ### EXPT not got txt based on click.### EXPT not got elt based on text.### EXPT elt not visible for click. ### EXPT not got txt based on click.### EXPT not got elt based on text.### EXPT elt not visible for click. ### EXPT not got txt based on click.### EXPT not got elt based on text.### EXPT elt not visible for click. ### EXPT not got txt based on click.### EXPT not got elt based on text.### EXPT elt not visible for click. ### EXPT not got txt based on click.### EXPT not got elt based on text.### EXPT elt not visible for click. ### EXPT not got txt based on click.### EXPT FAIL
Bill
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/y2wom8mFfS0J.
Isclass="xpop-content"
definitely unique to the page? (so find elements only returns a single element)
Does//div[contains(@class,'You will see a summary')]
throw the not found exception?
The class doesn't contain the string, so why expect it?
--
You received this message because you are subscribed to the Google Groups "webdriver" group.
To view this discussion on the web visit https://groups.google.com/d/msg/webdriver/-/IKXWwcRPro8J.
Thanks Darrell,
The weird thing is that the element is visible in the literal sense -
it appears in the screenshot, and most of the time I can get it with
getText() too. I'll check what isDisplayed says next.
> > � � void crazyGetReceiptSummaryTip() {
> > � � � � for (int i=0; i<10; i++) {
> > � � � � � � try {
> > � � � � � � � � WebElement we =
> > receiptSummaryHolder.findElement(By.xpath("//div[text()='You will see a
> > summary of your transfer as you proceed.']"));
> > � � � � � � � � System.out.println("### EXPT got elt based on text.");
> > � � � � � � � � return;
> > � � � � � � } catch (NoSuchElementException nsee) {
> > � � � � � � � � System.out.println("### EXPT not got elt based on text.");
> > � � � � � � }
> > � � � � � � try {
> > � � � � � � � � receiptSummaryTip.click();
> > � � � � � � � � System.out.println("### EXPT elt clickable.");
> > � � � � � � } catch (ElementNotVisibleException enve) {
> > � � � � � � � � System.out.println("### EXPT elt not visible for click.");
> > � � � � � � }
> > � � � � � � String s = receiptSummaryTip.getText();
> > � � � � � � if (s == null �|| �s.trim().length() == 0) {
> > � � � � � � � � System.out.println("### EXPT not got txt based on click.");
> > � � � � � � } else {
> > � � � � � � � � System.out.println("### EXPT GOT txt based on click: " + s);
> > � � � � � � � � return;
> > � � � � � � }
> > � � � � � � s = receiptSummaryTip.getText();
> > � � � � � � if (s != null �&& �s.length() > 0) {
> > � � � � � � � � System.out.println("### EXPT GOT w/ plain retry: " + s);
> > � � � � � � }
> > � � � � � � sleep(1000);
> > � � � � }
> > � � � � System.out.println("### EXPT FAIL");
> > � � }
> >
> > � � ### EXPT not got elt based on text.
> >
> > � � ### EXPT elt not visible for click.
> > � � ### EXPT not got txt based on click.
> >
> > � � ### EXPT not got elt based on text.
> >
> > � � ### EXPT elt not visible for click.
> > � � ### EXPT not got txt based on click.
> >
> > � � ### EXPT not got elt based on text.
> >
> > � � ### EXPT elt not visible for click.
> > � � ### EXPT not got txt based on click.
> >
> > � � ### EXPT not got elt based on text.
> >
> > � � ### EXPT elt not visible for click.
> > � � ### EXPT not got txt based on click.
> >
> > � � ### EXPT not got elt based on text.
> >
> > � � ### EXPT elt not visible for click.
> > � � ### EXPT not got txt based on click.
> >
> > � � ### EXPT not got elt based on text.
> >
> > � � ### EXPT elt not visible for click.
> > � � ### EXPT not got txt based on click.
> >
> > � � ### EXPT not got elt based on text.
> >
> > � � ### EXPT elt not visible for click.
> > � � ### EXPT not got txt based on click.
> >
> > � � ### EXPT not got elt based on text.
> >
> > � � ### EXPT elt not visible for click.
> > � � ### EXPT not got txt based on click.
> >
> > � � ### EXPT not got elt based on text.
> >
> > � � ### EXPT elt not visible for click.
> > � � ### EXPT not got txt based on click.
> >
> > � � ### EXPT not got elt based on text.
> >
> > � � ### EXPT elt not visible for click.
> > � � ### EXPT not got txt based on click.
> >
> > � � ### EXPT FAIL
> >
> > Bill
> >
> >
> >
> >
> >
> >
> >
> > On Wednesday, January 9, 2013 10:17:31 AM UTC-8, Smita Sinha wrote:
> >
> > > Try clicking the element before getText.
> > > This worked for me .
> > > I faced similar situation sometime back.
> >
> > > -Smita
> >
> > > On Wed, Jan 9, 2013 at 11:36 PM, BillR <ro...@cgl.ucsf.edu <javascript:>>wrote:
> >
> > >> Thanks, I know I'm getting the right element because
> > >> getAttribute("class") shows the right thing. I know there isn't a timing
> > >> issue because I did
> >
> > >> � � getText() - nothing
> > >> � � screenshot - text visible
> > >> � � getText() - nothing
> >
> > >> I tried this: WebElement we =
> > >> receiptSummaryHolder.findElement(By.xpath("//div[text()='You will see a
> > >> summary of your transfer as you proceed.']"));
> > >> but got NoSuchElementException. So from Webdriver's point of view, the
> > >> text doesn't seem to be visible in these intermittent cases.
> >
> > >> Bill
> >
> > >> On Wednesday, January 9, 2013 9:20:40 AM UTC-8, ASP wrote:
> >
> > >>> //div[@id='summaryTip']//div[@**class='xpop-content'][text()='**You
> > >>> will see a summary of your transfer as you proceed. ']
> >
> > >>> try to use above xpath and see
> >
> > >>> in my experience sometimes selenium tries to read even before page is
> > >>> loaded ... so I would recommend use proper wait methods ... you can try
> > >>> something like Thread.sleep(2000) just to verify
> >
> > >>> see how that goes
> >
> > >>> ASP
> >
> > >> �--
> > >> You received this message because you are subscribed to the Google Groups
> > >> "webdriver" group.
> > >> To view this discussion on the web visit
> > >>https://groups.google.com/d/msg/webdriver/-/0n7rkJsaHqkJ.
> >
> > >> To post to this group, send email to webd...@googlegroups.com<javascript:>
> > >> .
> > >> To unsubscribe from this group, send email to
> > >> webdriver+...@googlegroups.com <javascript:>.
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/webdriver?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "webdriver" group.
> To post to this group, send email to webd...@googlegroups.com.
> To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.
@@@ div class [xpop-content] readonly=null hidden=null disabled=null
@@@ div class [xpop-content-container] readonly=null hidden=null disabled=null
@@@ div class [xpop xtip size-medium useCloseBox xpop-position-bottom active] readonly=null hidden=null disabled=null
@@@ body class [lang-en isDesk layout-wide layout-leather svg-true placeholder] readonly=null hidden=null disabled=null
@@@ html class [] readonly=null hidden=null disabled=null
> To unsubscribe from this group, send email to webdriver+unsubscribe@googlegroups.com.
Parent of Visible: @@@ div class [xpop xtip size-medium useCloseBox xpop-position-bottom active] style [width: 275px; top: 357px; left: 336px; z-index: 20;] readonly=null hidden=null disabled=null
Parent of Invisible: @@@ div class [xpop xtip size-medium useCloseBox xpop-position-bottom active] style [width: 275px; top: 305px; left: 336px; z-index: 20;] readonly=null hidden=null disabled=null
Bill
org.openqa.selenium.NoSuchElementException: The element could not be found (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 1.03 seconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: '2.28.0', revision: '18309', time: '2012-12-11 20:21:18' System info: os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.35-32-generic', java.version: '1.6.0_37' Session ID: f47584bdae76c5dd4190f1fa74aacd9b Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{platform=LINUX, chrome.chromedriverVersion=23.0.1240.0, acceptSslCerts=false, javascriptEnabled=true, browserName=chrome, rotatable=false, locationContextEnabled=false, version=26.0.1380.0, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled=true, chrome.nativeEvents=false, applicationCacheEnabled=false, takesScreenshot=true}]Bill
I am finding that WebElement.getText() returns an empty string sometimes, but when it happens and I take a screenshot, the text is there. When I getAttribute("class") I see that I have found the right element, but it doesn't give me the text. Not sure if this would be a webdriver of FF bug. (A parent div has 'active' appended to its class when the popup containing the text appears, and this seems reliable.)
Has anyone seen this sort of thing? I see it running 1 test thread as well as >1.
Thanks,
Bill
FF 17.0
selenium-server-standalone-2.28.0.jar
Ubuntu with Xvfb
Html:
<div id="summaryTip" class="xpop xtip size-medium useCloseBox xpop-position-bottom active" style="width: 275px; top: 305px; left: 738px; z-index: 20;">
<div class="xpop-content-container">
<a class="xpop-close">x</a>
<div class="xpop-title"></div>
<div class="xpop-content">You will see a summary of your transfer as you proceed. </div>
</div>
<div class="xpop-pointer" ...</div>
</div>
Code:
@FindBy(id = "summaryTip")
WebElement receiptSummaryHolder;
//@FindBy(xpath = "//div[@id='summaryTip']/div/div[2]")
@FindBy(css = "#summaryTip .xpop-content")
WebElement receiptSummaryTip;
boolean receiptSummaryTipActive() {
String s = receiptSummaryHolder.getAttribute("class");
System.out.println("### summaryTip class: " + s);
return s.contains("active");
}
String getReceiptSummaryTip() {
String s = receiptSummaryTip.getText();
if (s == null || s.trim().length() == 0) {
System.out.println("### empty, class = " + receiptSummaryTip.getAttribute("class"));
WebElement we = receiptSummaryHolder.findElement(By.className("xpop-content"));
System.out.println("### by.class [" + we.getText() + "] [" + we.getAttribute("class") + "]");
return we.getText();
}
System.out.println("### NOT EMPTY: [" + s + "]");
return s;
}
Output:### empty, class = xpop-content ### by.class [] [xpop-content] Screenshot: screenshots/1357682907182_8_no_rcpt_summary_1.png [shows text]### empty, class = xpop-content ### by.class [] [xpop-content] ### summaryTip class: xpop xtip size-medium useCloseBox xpop-position-bottom active