-1

Here is my HTML code:

<a target="_blank" href="http://keyes.findbuyers.com/search_details/hGdxEaI0bAO568MBDtCCfvjtY74dYmJKhIeURpGbbtxBQvzbNLwrKJL381lFafq10-YkJ58zGW6Lc8fpOny7fW/customerservice@keyes.com">
999 SW 1st Ave
<br/>
Miami, FL 33130
</a>

When I print the address it is displaying it on two lines in the console:

999 SW 1st Ave
Miami, FL 33130

I want to print the address like this:

999 SW 1st Ave, Miami, FL 33130

How can I do that?

enigma
  • 3,476
  • 2
  • 17
  • 30

3 Answers3

0

When you print on console an new line is indicated by special character '\r' or '\n' or '\r\n' (depending on OS).

The same new line will not work in browser, however if you want to retain new line in browser either you can enclose your text in a <pre> tag or you can replace '\r\n' with a <br> tag.

0

<Br/> tag is to mark break line, so it's normal that the address is split in two lines, in order to print it in one line get rid of this tag.

But if you want to get your address in one line using Java, you may update your line as follow:

...
String addr=address.get(0).getText().replaceAll("(\\r|\\n)+", ",");

Both windows and Unix carriage return character are covered.

O.Badr
  • 2,853
  • 2
  • 27
  • 36
0

Just remove the tag <br/>

Ravi MCA
  • 2,491
  • 4
  • 20
  • 30
  • @srinuvasareddymarri refer hear http://stackoverflow.com/questions/33199740/webdriver-remove-element-from-page – Ravi MCA Feb 06 '17 at 15:52