How to remove space from Xpath?



  • <div class="" id="paymentLanding">
    
    <div class="row" data-card="627720102532112471"  data-default="true">
        <div class="col-sm-12 col-xs-12 col-md-12 default">
            <div class="row club-card" aria-label="Club-Card" tabindex="0">
                <div class="col-sm-2 col-xs-3 col-md-2 check-icon">
                    <img src="/-/media/project/profile-center/baseenglish/images/payment/icon-clubcard.ashx" alt="">
                </div>
                <div class="col-sm-10 col-xs-9 col-md-10 card-details">
                    <div class="card-type">
                        Club Card
                    </div>
                    <div class="card-desc">Ending in 0447</div>
                </div>
            </div>
        </div>
    </div>
    </div>
    
    

    Hi, im trying to get clubcards with xpath and i do get them with Xpath Get Text List

    //*[@id="paymentLanding"]/div[*]/div/div/div[2]
    

    When i log its looks correct

    Club Card Ending in 0736, Club Card Ending in 0350
    

    But when i save to file its lot empty space and my question is how to make it look good. Trim wouldn't work as its list, has multiple items

    Cards: 
                    
                        Club Card
                    
                    
                        Ending in 1097
                    
                ,
                    
                        Club Card
                    
                    
                        Ending in 0350


  • @gudolik said in How to remove space from Xpath?:

    But when i save to file its lot empty space and my question is how to make it look good. Trim wouldn't work as its list, has multiple items

    You can replace all line breaks and spaces with a single space through a regular expression

    9b3b36b6-898c-4c4c-ac2e-324bf1233fd2-изображение.png

    test script



  • This post is deleted!


  • Thanks to @Fox and here the complete version 1582309913878-332.xml if anyone needs it in future


Log in to reply