Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4068800
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:25:12+00:00 2026-05-20T16:25:12+00:00

I am trying to access some text that is located in a DIV. I

  • 0

I am trying to access some text that is located in a DIV.
I need to check to see if the page holds the text so I can return a true or false.
The code I am using is below:

cancel = browser.text.include?("Current Cancelled")
if cancel == true
puts "Line item cancelled"
else
puts "****Line item not cancelled****"
end

But it returns false every time.
Here is a code snippet of what I am looking into:

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T16:25:13+00:00Added an answer on May 20, 2026 at 4:25 pm

    The probable reason this isn’t working is because the string you’re testing for contains a newline character and a non breaking space.

    This could work…

    if browser.div(:text, /Current.*Cancelled/).exists?
      puts "Line item cancelled"
    else
      puts "****Line item not cancelled****"
    end
    

    or

    if browser.text =~ /Current.*Cancelled/
      puts "Line item cancelled"
    else
      puts "****Line item not cancelled****"
    end
    

    etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WPF app that creates some text files in its own install
This is my first post. I'm trying to do some basic meta-programming with javascript,
I've been trying to get the text of items in listview another process. I
I'm writing an auto testing framework using Selenium. I am trying to test our
I'm trying to setup custom error pages. I put the pages in /error/ in
I'm trying to write my first program in C# without the use of a
I'm trying to write my first program in C# without the use of a
We've got a Rails application just upgraded to Rails3 using Devise's Rails3 gem for
i have just started using servlet. basically i am new to web projects. I
EDIT: Heres the link to the stringparsing.bat file incase the other one didnt work

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.