Trailing whitespace is added

Issue #14907415 • Assigned to Steven K.

Details

Author
Mark D.
Created
Dec 1, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Standard affected
WebDriver

Found in build #
15.15063
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

In some cases I see that the Edge driver is adding an extra whitespace the the text string of an element I’m trying to match.
See the attachment for the active Li element and the text shown without a whitespace.

When I get this text with Watir via element.text

'’’irb
irb(main):013:0> div = browser.wait(:like => [:div, :class, ‘mp-tabpages breadcrumb clearfix’], :filter_by => :visible?)
=> #<Watir::Div: located: true; {:xpath=>"//div[contains(concat('’, normalize-space(@class), ‘’), ‘mp-tabpages breadcrumb clearfix’)]", :tag_name=>"div", :index=>0}>
irb(main):014:0> active_li = browser.find(:like => [:li, :class, ‘active’], :context => div)
=> #<Watir::LI: located: true; {:xpath=>"//div[contains(concat('’, normalize-space(@class), ‘’), ‘mp-tabpages breadcrumb clearfix’)]", :tag_name=>"div", :index=>0} --> {:xpath=>".//li[contains(concat('’, normalize-space(@class), ‘’), ‘active’)]", :tag_name=>"li", :index=>0}>
irb(main):015:0> element = browser.find(:like => [:div, :class, ‘note2’], :context => active_li, :filter_by => :exists?)
=> #<Watir::Div: located: true; {:xpath=>"//div[contains(concat('’, normalize-space(@class), ‘’), ‘mp-tabpages breadcrumb clearfix’)]", :tag_name=>"div", :index=>0} --> {:xpath=>".//li[contains(concat('’, normalize-space(@class), ‘’), ‘active’)]", :tag_name=>"li", :index=>0} --> {:xpath=>".//div[contains(concat('’, normalize-space(@class), ‘’), ‘note2’)]", :tag_name=>"div", :index=>0}>
irb(main):016:0> element.flash
=> #<Watir::Div: located: true; {:xpath=>"//div[contains(concat('’, normalize-space(@class), ‘’), ‘mp-tabpages breadcrumb clearfix’)]", :tag_name=>"div", :index=>0} --> {:xpath=>".//li[contains(concat('’, normalize-space(@class), ‘’), ‘active’)]", :tag_name=>"li", :index=>0} --> {:xpath=>".//div[contains(concat('’, normalize-space(@class), ‘’), ‘note2’)]", :tag_name=>"div", :index=>0}>
irb(main):017:0> element.text
=> "Standard Task - 289 "
irb(main):018:0>
‘’’

It suddenly added a whitespace at the end of the string.
This only happens with Edge, not with FF/Chrome

Attachments

Comments and activity

  • Oew I can’t edit my post anymore…
    I’m using Ruby + selenium and watir (via the lapis_lazuli gem which uses the syntax I use to find the element, but I can do the same with Watir/Selenium, results are the same).

  • Since the case is slightly different I created a new ticket for it. But it could very well be a duplicate of this one: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/5569343/

  • Workaround for now that I use if to always do element.text.strip

  • Microsoft Edge Team

    Changed Assigned To to “Steven K.”

You need to sign in to your Microsoft account to add a comment.

Sign in