2

I have written a script to try and print all of the individual links for items listed on a particular web page. Here is the code so far:

from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.chrome.options import Options


options=Options()

driver=webdriver.Chrome(options=options)

driver.get('https://www.lazada.com.ph/shop-portable-speakers/?spm=a2o4l.home.cate_2_2.2.239e359dxynAFV')

link_elements=driver.find_elements(By.NAME,'product-item')

links = []
for link_el in link_elements:
    href = link_el.get_attribute("href")
    print (href)
    links.append(href)
driver.quit()

Any ideas as to what I am doing wrong here?.

ThiefMaster
  • 310,957
  • 84
  • 592
  • 636

3 Answers3

3

You instantly try and search for product-item before the webpage has a chance to fully load. Wait until the webpage is loaded. Add a time.sleep() after your driver.get()

import time

sec = 5

time.sleep(sec)

Or you can wait for a specific element to load on the webpage using the following:

# New Imports to add
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait

# Create a wait object with a specified maximum time to wait
maxTimeToWait = 20
wait = WebDriverWait(driver, maxTimeToWait)

driver.get('https://www.lazada.com.ph/shop-portable-speakers/?spm=a2o4l.home.cate_2_2.2.239e359dxynAFV')

# This will wait for the specified element to appear, but note just because this element has loaded does not mean that the elements below this element have loaded
link_element = wait.until(EC.presence_of_element_located((By.NAME, 'product-item')

# Then find all of the elements with this name
link_elements=driver.find_elements(By.NAME,'product-item')
cruisepandey
  • 28,520
  • 6
  • 20
  • 38
SPYBUG96
  • 1,089
  • 5
  • 20
  • 38
  • I tried using time.sleep(): from selenium.webdriver.common.by import By from selenium import webdriver from selenium.webdriver.chrome.options import Options import time options=Options() driver=webdriver.Chrome(options=options) driver.get('https://www.lazada.com.ph/shop-portable-speakers/?spm=a2o4l.home.cate_2_2.2.239e359dxynAFV' ) time.sleep(10) link_elements=driver.find_elements(By.NAME,'product-item') links = [] for link_el in link_elements: href = link_el.get_attribute("href") print (href) links.append(href) But nothing prints. –  Apr 24 '22 at 12:25
  • I tried your second suggestion. I get the following error: Traceback (most recent call last): File "C:\Users\David\Desktop\Selenium\untitled5.py", line 21, in link_element = wait.until(EC.presence_of_element_located((By.NAME, 'product-item'))) File "C:\Users\David\anaconda3\lib\site-packages\selenium\webdriver\support\wait.py", line 89, in until raise TimeoutException(message, screen, stacktrace) TimeoutException –  Apr 24 '22 at 13:12
  • @DavidCopperfield the TimeoutException will be thrown in this case when the specified element `(By.NAME, 'product-item')` is not loaded/found within the webpage within the specified amount of time. Are you sure the webpage contains an element with the `` – SPYBUG96 Apr 24 '22 at 13:17
1

The product links are contained within the src attribute. As an example:

<img age="0" type="product" class="jBwCF " alt="LEERFEI E-91 bluetooth Speaker Sound bar with subwoofer Sound card With USB Por TF AUX Smart Sound bar TV Speaker Home Theatre For TV PC" src="https://lzd-img-global.slatic.net/g/p/b5e64a3099b0b8d7ca36986909c1e213.jpg_200x200q80.jpg_.webp" style="object-fit: fill;">

Solution

To print the value of the src attributes you have to induce WebDriverWait for the visibility_of_all_elements_located() and you can use either of the following Locator Strategies:

  • Using CSS_SELECTOR:

    driver.get("https://www.lazada.com.ph/shop-portable-speakers/?spm=a2o4l.home.cate_2_2.2.239e359dxynAFV")
    print([my_elem.get_attribute("src") for my_elem in WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, "div.picture-wrapper>img[type='product']")))])
    
  • Using XPATH in a single line:

    driver.get("https://www.lazada.com.ph/shop-portable-speakers/?spm=a2o4l.home.cate_2_2.2.239e359dxynAFV")
    print([my_elem.get_attribute("src") for my_elem in WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.XPATH, "//div[@class='picture-wrapper']/img[@type='product']")))])
    
  • Console Output:

    ['https://lzd-img-global.slatic.net/g/p/4cdcf0125c301266fe7c0e1004b5a435.png_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/0c8b59946bbf796b0cf3931a96c6370a.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/5b5fc2ed633bd48c1fb2e2c4312756f8.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/486c93c9d03ad47268307f1073286baf.png_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/b06bd4c0b78b4f4d0b8026392f8f39cd.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/15224b1fb1446eddf2a95afb23cf7046.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/cff844c6e38761d956478104970a3e16.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/ca0eb3ba62e97874f06752b6b3611e34.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/b45fd9513f86efcf66a947286f314133.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/0a9dcda2aaac65996b5fa7bc35d40d7d.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/648aeb1dff5c0ea8e33ef86baa20881e.png_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/8625845c2d11c4b9613b1db899d109f4.png_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/b5627d2427021e81596c2fe0dcfc485c.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/49b4c1168e6145056a5e5f7a2a7aa9dd.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/8b58661402a26f48373e8b767f4768e9.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/d273ecbdebdecd893a057ab532baa248.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/6618804d6ab326773e402def53f0b378.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/d38d70e2650b74ce1f07767878263027.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/c88b9713573065ce7779e1a4020248b0.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/f16c7a8d201eb17b3d6b2692f8d22974.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/0bb3e0090c1fd561ec5a4c19316c2afb.png_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/f11b1eb2c12d4919fa39c39491b4992d.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/b76540bea6d569b181250f98bb5ea0e8.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/d1694d4083e46ad2c227dc848980269c.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/cc91211da528c101dbd891baaf1ff13c.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/231adb730f9f0d4629ac3801d7eed7a6.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/5e6b63361ff76713b594e03d433b20c6.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/84e864e4ed14b2ee69538dac74f35355.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/0611a9678108c1de7765fefd3ccc0232.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/ca47f523b0dfdc52afb6b99dae25c8a0.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/d7c900d8e3c1d0d3f1c112949c352d30.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/fe77cf1c0cb75d2c5ac56304ab694b91.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/b18241a2b7ff47ad06109ee9e87bc5c7.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/b64da52a80bde951e7b0667b09eef892.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/3dcbf8068675d4a6f22fc38a8efe3b94.png_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/2072df22427ed5d5cfed506c1d420cb3.png_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/833fa8fa0121d983e131fdf12b6528aa.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/9e2f8db84dc245bb3e7f582953a19499.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/ec98df1bdaf343709b76fab7ea8aa083.jpg_200x200q80.jpg_.webp', 'https://lzd-img-global.slatic.net/g/p/7b36600fccf1256b9402e886364820a9.jpg_200x200q80.jpg_.webp']
    
  • Note : You have to add the following imports :

    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support import expected_conditions as EC
    

Alternative

Incase you are targetting the href attributes you can also use the following locator strategy:

driver.get("https://www.lazada.com.ph/shop-portable-speakers/?spm=a2o4l.home.cate_2_2.2.239e359dxynAFV")
print([my_elem.get_attribute("href") for my_elem in WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.XPATH, "//div[@class='picture-wrapper'][.//img[@type='product']]//ancestor::a[1]")))])

Console Output:

['https://www.lazada.com.ph/products/leerfei-e-91-bluetooth-speaker-sound-bar-with-subwoofer-sound-card-with-usb-por-tf-aux-smart-sound-bar-tv-speaker-home-theatre-for-tv-pc-i2667501800.html', 'https://www.lazada.com.ph/products/portable-wired-soundbar-bluetooth-speaker-heavy-bass-laptop-multimedia-home-theatre-subwoofer-pc-tv-game-music-i2897668393.html', 'https://www.lazada.com.ph/products/bumblebee-bluetooth-speaker-mini-wireless-speakers-subwoofer-stereo-transformers-led-flashing-light-bt-boombox-for-fm-mp3-tf-i584550542.html', 'https://www.lazada.com.ph/products/bluetooth-speaker-portable-outdoor-loudspeaker-wireless-mini-column-3d-stereo-music-surround-bass-box-i2910971482.html', 'https://www.lazada.com.ph/products/bluetooth-speaker-portable-wireless-column-waterproof-hifi-lossless-sound-quality-stereo-subwoofer-loudspeaker-i2704368682.html', 'https://www.lazada.com.ph/products/bluetooth-speaker-outdoor-cloth-waterproof-card-bluetooth-mini-light-emitting-small-audio-i2897863220.html', 'https://www.lazada.com.ph/products/bluetooth-speaker-portable-4d-surround-soundbar-wired-and-wireless-bluetooth-50-stereo-subwoofer-sound-bar-for-laptop-pc-home-theater-tv-aux-speaker-i2923499801.html', 'https://www.lazada.com.ph/products/bluetooth-speaker-portable-wireless-loudspeaker-colorful-led-light-usb-subwoofer-speaker-support-fm-radiou-disk-i2923501827.html', 'https://www.lazada.com.ph/products/bluetooth-soundbar-4d-surround-bluetooth-50-computer-speaker-bar-stereo-sound-subwoofer-bluetooth-speaker-for-macbook-laptop-notebook-pc-music-player-wired-loudspeaker-i2700651168.html', 'https://www.lazada.com.ph/products/home-theater-sound-system-bluetooth-speaker-4d-surround-soundbar-computer-speakers-for-tv-soundbar-box-subwoofer-i2913366288.html', 'https://www.lazada.com.ph/products/speaker-bluetooth-big-sound-with-rechargeable-microphone-karaoke-30w-bluetooth-speaker-sdrd-sd306-for-video-audio-sound-system-family-ktv-stereo-mic-with-2-wireless-mic-with-microphone-i2891823088.html', 'https://www.lazada.com.ph/products/super-large-number-of-charging-treasures-with-their-own-line-mini-mobile-phone-fast-charging-corn-20000-mah-portable-ile-mini-ultra-thin-compact-portable-suitable-for-huawei-apple-special-millet-super-large-capacity-i2723909869.html', 'https://www.lazada.com.ph/products/ultra-capacity-portable-charging-treasure-i-ultra-thin-and-compact-suitable-for-huawei-apple-dedicated-millet-with-its-own-line-mini-mobile-phone-fast-charging-corn-20000-mah-portable-ile-min-large-capacity-i2727136223.html', 'https://www.lazada.com.ph/products/new-kimiso-qs-222-portable-bluetooth-wireless-speaker-karaoke-with-remote-and-mic-i2694460362.html', 'https://www.lazada.com.ph/products/abro-mini-power-bank-20000-mah-powerbank-pomona-corn-portable-ile-mini-lightweight-power-bank-orginal-barad-fast-charging-i2919024057.html', 'https://www.lazada.com.ph/products/ht-mini-power-bank-pomona-corn-20000-mah-portable-ile-mini-lightweight-power-bank-i2883299696.html', 'https://www.lazada.com.ph/products/kuku-xq3-bluetooth-speaker-mini-wireless-bluetooth-speaker-mini-fm-phone-support-slot-built-in-tf-card-u-disk-slot-i381706410.html', 'https://www.lazada.com.ph/products/pomona-corn-20000-mah-portable-ile-mini-lightweight-power-bank-i2922753225.html', 'https://www.lazada.com.ph/products/marshall-emberton-bluetooth-speaker-includes-speaker-pack-1-year-warranty-free-shipping-bluetooth-speakers-portable-speakers-portable-bluetooth-speakers-i2849420064.html', 'https://www.lazada.com.ph/products/portable-wireless-bluetooth-speaker-hifi-super-bass-led-flash-light-karaoke-kts-speaker-1603-i2843285907.html', 'https://www.lazada.com.ph/products/marshall-emberton-bluetooth-speaker-100-original-authentic-free-shipping-i2886230133.html', 'https://www.lazada.com.ph/products/airforce-one-do-not-buy-during-test-product-i2952906467.html', 'https://www.lazada.com.ph/products/original-spot-marshall-bluetooth-speaker-portable-outdoor-waterproof-bluetooth-speaker-mini-bluetooth-audio-quality-assurance-genuine-warranty-1-year-i2865331828.html', 'https://www.lazada.com.ph/products/kuku-99-led-85wireless-bluetooth-speaker-wireless-karaoke-system-support-usb-tf-card-expansion-fm-radio-function-free-microphone-i2547444852.html', 'https://www.lazada.com.ph/products/kuku-k-8802-led-85wireless-bluetooth-speaker-wireless-karaoke-system-support-usb-tf-card-expansion-fm-radio-function-free-microphone-i2725501696.html', 'https://www.lazada.com.ph/products/computer-speakers-home-theater-sound-system-bluetooth-speaker-4d-surround-soundbar-computer-speakers-for-tv-soundbar-box-subwoofer-i2909245761.html', 'https://www.lazada.com.ph/products/portable-wireless-bluetooth-speaker-hifi-super-bass-led-flash-light-karaoke-kts-speaker-1601-i2903822480.html', 'https://www.lazada.com.ph/products/2pcslot-1n5400-1n5401-1n5402-1n5404-1n5406-1n5408-rectifier-diode-3a-50v-1000v-i1754530186.html', 'https://www.lazada.com.ph/products/charge-mini2-portable-wireless-bluetooth-speaker-high-quality-i2700831421.html', 'https://www.lazada.com.ph/products/new-airpro-3-bluetooth-wireless-earbuds-gps-renamed-pop-window-wireless-headset-with-microphonenew-airpro-3-bluetooth-wireless-earbuds-gps-renamed-pop-up-wireless-headphones-with-microphone-suitable-for-all-models-of-mobile-phones-6-8-hours-of-charging-i2570417591.html', 'https://www.lazada.com.ph/products/tg-tg-113-super-bass-splashproof-wireless-bluetooth-speaker-i141814659.html', 'https://www.lazada.com.ph/products/extreme-big-bluetooth-speaker-extreme-waterproof-speaker-wireless-speaker-i2903712949.html', 'https://www.lazada.com.ph/products/goodmobile-x-bass-t2359m-subwoofer-bluetooth-speaker-free-wired-microphone-stylish-portable-karaoke-system-i585134811.html', 'https://www.lazada.com.ph/products/tg-tg-182-tws-portable-wireless-bluetooth-hifi-speaker-support-solar-panel-with-fmtf-cardauxusb-function-i986326464.html', 'https://www.lazada.com.ph/products/pomona-corn-20000-mah-portable-ile-mini-lightweight-power-bank-mini-portable-powerbank-power-bank-original-i2546429509.html', 'https://www.lazada.com.ph/products/tg-113-super-bass-splashproof-portable-wireless-bluetooth-speaker-i260078954.html', 'https://www.lazada.com.ph/products/original-super-bass-portable-bluetooth-speaker-with-mic-bt-1308-bt-1309-3-inch-wireless-bluetooth-speaker-with-led-light-tws-link-bluetooth-speaker-tfusbfm-radioauxledmicbt-speaker-karaoke-system-wireless-bluetooth-speaker-i2352754092.html', 'https://www.lazada.com.ph/products/siiim9original-jbl-charge-3-mini-portable-bluetooth-wireless-speaker-multicolor-luminous-portable-bluetooth-wireless-speaker-splashproof-with-built-in-powerbank-jbl-charge-3-speaker-i678390318.html', 'https://www.lazada.com.ph/products/bluetooth-speaker-wireless-bass-column-waterproof-outdoor-small-soundbar-subwoof-supports-tf-card-i2907319261.html', 'https://www.lazada.com.ph/products/85-inches-bluetooth-speaker-free-mic-karaoke-portable-super-bass-led-speakers-microphone-i2893332393.html']
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Thanks for your help. Just out of curiosity. Why is it when I search by class and then class again why does it not work for XPATH: print([my_elem.get_attribute("src") for my_elem in WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.XPATH, "//div[@class='picture-wrapper']/img[@class='jBwCF']")))]) –  Apr 24 '22 at 13:57
  • The classname value **jBwCF** is dynamically generated. So everytime you access the application the value will change. This change may happen in periodic intervals as well. Checkout the updated answer and let me know the status. – undetected Selenium Apr 24 '22 at 14:43
  • The code that you have now and your previous code which was: #print([my_elem.get_attribute("src") for my_elem in WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.XPATH, "//div[@class='picture-wrapper']/img[@type='product']")))]) all worked perfectly. But I was just curious to know why I also couldn't specify it by 'class' instead of 'type'. I know you mentioned that the class will change but I have been checking it and it is always 'jBwCF'. So even if it changes in future shouldn't it at least work for now? or am I misunderstanding?. Thanks –  Apr 24 '22 at 14:55
  • Clearly **`jBwCF`** is not a static value which is prone to changes at certain interval. The more you handle these cases the more you will gain the experience :) – undetected Selenium Apr 24 '22 at 14:58
1

Actually , the problem was element locator selection.

To get product links you can use this locator strategy using xpath.

 for link_el in link_elements:
    a_el = link_el.find_element(By.XPATH,'.//*[@class="RfADt"]/a')
    href = a_el.get_attribute("href")

Full code:

import time
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))


url = 'https://www.lazada.com.ph/shop-portable-speakers/?spm=a2o4l.home.cate_2_2.2.239e359dxynAFV'     

driver.get(url)
driver.maximize_window()
time.sleep(5)

link_elements=driver.find_elements(By.XPATH,'//*[@class="_17mcb"]/div')

links = []
for link_el in link_elements:
    a_el = link_el.find_element(By.XPATH,'.//*[@class="RfADt"]/a')
    href = a_el.get_attribute("href")
    print (href)
    links.append(href)
#driver.quit()
#print(links)

Output:

https://www.lazada.com.ph/products/101z-6w-usb-20-mini-portable-speakers-computer-soundbox-with-35mm-stereo-jack-and-usb-powered-for-pc-laptop-smartphone-i1301086658.html
https://www.lazada.com.ph/products/crfstore-mini-1090c-8inch-portable-karaoko-bluetooth-speaker-with-microphone-i2564832556.html
https://www.lazada.com.ph/products/awei-y370-portable-bluetooth-wireless-ipx6-speaker-outdoor-tws-waterproof-good-sound-quality-i2550159216.html
https://www.lazada.com.ph/products/bluetooth-soundbar-4d-surround-bluetooth-50-computer-speaker-bar-stereo-sound-subwoofer-bluetooth-speaker-for-macbook-laptop-notebook-pc-music-player-wired-loudspeaker-i2700651168.html
https://www.lazada.com.ph/products/tg-tg-113-super-bass-splashproof-wireless-bluetooth-speaker-i141814659.html
https://www.lazada.com.ph/products/wireless-bluetooth-speaker-bluetooth-compatible-speaker-wireless-sound-system-3d-stereo-speakerusb-charg-portable-waterproof-speaker-i2706336349.html    
https://www.lazada.com.ph/products/original-super-bass-portable-bluetooth-speaker-with-mic-bt-1308-bt-1309-3-inch-wireless-bluetooth-speaker-with-led-light-tws-link-bluetooth-speaker-tfusbfm-radioauxledmicbt-speaker-karaoke-system-wireless-bluetooth-speaker-i2352754092.html        
https://www.lazada.com.ph/products/v2s-desktop-speaker-laptop-cable-mini-usb-speaker-small-stereo-speaker-mini-speaker-portable-speakers-multi-function-speaker-for-pc-desktop-i2340265580.html
https://www.lazada.com.ph/products/tg-tg-182-tws-portable-wireless-bluetooth-hifi-speaker-support-solar-panel-with-fmtf-cardauxusb-function-i986326464.html
https://www.lazada.com.ph/products/2x8-inches-qs220-portable-wireless-bluetooth-party-speaker-with-free-microphone-i2739394064.html
https://www.lazada.com.ph/products/speaker-bluetooth-big-sound-with-rechargeable-microphone-karaoke-30w-bluetooth-speaker-sdrd-sd306-for-video-audio-sound-system-family-ktv-stereo-mic-with-2-wireless-mic-with-microphone-i2891823088.html
https://www.lazada.com.ph/products/120-wireless-bluetooth-speaker-with-free-microphone-i1913627741.html
https://www.lazada.com.ph/products/flagship-portable-led-bluetooth-mini-speaker-support-phonelaptoptablet-pctf-cardmini-micro-card-wireless-bluetooth-speaker-portable-line-in-speakers-i503222780.html
https://www.lazada.com.ph/products/original-spot-marshall-bluetooth-speaker-portable-outdoor-waterproof-bluetooth-speaker-mini-bluetooth-audio-quality-assurance-genuine-warranty-1-year-i2865331828.html
https://www.lazada.com.ph/products/yoobao-m1-portable-bluetooth-speaker-blue-i1617152993.html
https://www.lazada.com.ph/products/mitsushi-electronics-bt02-102-bluetooth-speaker-portable-speaker-ipx6-waterproof-speaker-powerful-360-stereo-super-bass-bluetooth-speaker-smart-sound-speaker-ic-wire-free-music-calls-portable-bluetooth-speaker-partycase-with-rgb-light-i1355320413.html
https://www.lazada.com.ph/products/wireless-bluetooth-speakers-led-light-karaoke-portable-super-bass-led-with-free-microphone-i2444880918.html
https://www.lazada.com.ph/products/portable-bluetooth-speaker-aterproof-bluetooth-speaker-portable-wireless-hands-free-speaker-shower-bathroom-swimming-pool-car-beach-outdoor-i2702607893.html
https://www.lazada.com.ph/products/tg-tg-113a-super-bass-splashproof-wireless-bluetooth-speaker-i467294635.html
https://www.lazada.com.ph/products/101z-6w-usb-20-mini-portable-speakers-computer-soundbox-with-35mm-stereo-jack-and-usb-powered-for-pc-laptop-smartphone-i1056960618.html
https://www.lazada.com.ph/products/bluetooth-speaker-wireless-bass-column-waterproof-outdoor-small-soundbar-subwoof-supports-tf-card-i2907319261.html
https://www.lazada.com.ph/products/siiim9original-jbl-charge-3-mini-portable-bluetooth-wireless-speaker-multicolor-luminous-portable-bluetooth-wireless-speaker-splashproof-with-built-in-powerbank-jbl-charge-3-speaker-i678390318.html
https://www.lazada.com.ph/products/surround-speaker-bluetooth-pc-soundbar-wired-and-wireless-bluetooth-speaker-usb-powered-soundbar-for-tv-pc-laptop-gaming-home-theater-surround-audio-system-i2701119277.html
https://www.lazada.com.ph/products/mitsushi-orashare-bs02-tws-bluetooth-speaker-wireless-outdoor-portable-subwoofer-bluetooth-speaker-partycast-with-rgb-light-super-bass-bluetooth-speaker-360-stereo-bluetooth-speaker-support-various-play-modebluetooth-50-tf-i2493610785.html        
https://www.lazada.com.ph/products/original-yoobao-m1-ergonomic-design-portable-wireless-bluetooth-speaker-v42-with-built-in-mic-i378866777.html
https://www.lazada.com.ph/products/marshall-emberton-100-authenticin-stock-original-bluetooth-speaker-portable-outdoor-ipx7-waterproof-bluetooth-speakerauthentic-warranty-1-year-i2860684913.html
https://www.lazada.com.ph/products/owwyykv2-sdrd-sd-306-plus-wireless-bluetooth-dual-microphone-karaoke-portable-3d-stereo-speaker-mic-i2730123881.html
https://www.lazada.com.ph/products/pomona-corn-20000-mah-portable-ile-mini-lightweight-power-bank-mini-portable-powerbank-power-bank-original-i2546429509.html
https://www.lazada.com.ph/products/soundbar-speaker-bluetooth-speaker-waterproof-portable-wireless-speaker-subwoofer-speaker-notebook-computer-multimedia-bluetooth-speaker-home-theater-i2706784709.html
https://www.lazada.com.ph/products/ezeey-v2s-portable-usb-35mm-multimedia-speaker-for-desktop-laptop-notebook-tablet-smartphones-pc-speaker-note-no-option-of-brand-i232726566.html
https://www.lazada.com.ph/products/siiim9original-jbl-charge-3-mini-portable-bluetooth-wireless-speaker-splashproof-with-built-in-powerbank-jbl-charge-3-speaker-jbl-charge-3-mini-i2874106831.html
https://www.lazada.com.ph/products/oontz-angle-3-4th-gen-bluetooth-portable-speaker-crystal-clear-stereo-sound-rich-bass-mic-ipx-5-100-feet-wireless-range-play-two-speakers-together-4th-gen-only-i1315674652.html
https://www.lazada.com.ph/products/d-02a-6w-usb-20-mini-portable-speakers-computer-soundbox-with-35mm-stereo-jack-and-usb-powered-for-pc-laptop-smartphone-i1349384764.html
https://www.lazada.com.ph/products/ezeey-portable-usb-35mm-multimedia-speaker-for-desktop-laptop-notebook-tablet-smartphones-pc-speaker-i512050029.html
https://www.lazada.com.ph/products/ystery-pouch-or-get-this-speaker-bluetooth-with-microphone-original-speaker-15-inches-500watts-with-box-speaker-bluetooth-470-wireless-speaker-bluetooth-speaker-colorful-lamp-with-memory-card-usb-free-microphone-i2877890799.html
https://www.lazada.com.ph/products/portable-voice-amplifier-loudspeaker-loudspeaker-with-line-microphone-loudspeaker-speaker-mp3-i2585572655.html
https://www.lazada.com.ph/products/portablebluetoothspeaker-wireless-creative-bluetooth-speaker-outdoor-sports-waterproof-mini-portable-collectionloudspeaker-stereo-music-sound-box-portable-bluetooth-speaker-karaok-i2705701480.html
https://www.lazada.com.ph/products/awei-y500-mini-wireless-bluetooth-speaker-metal-stereo-music-hands-free-calls-support-auxtf-i1530232651.html
https://www.lazada.com.ph/products/m5-wireless-bluetooth-speaker-dual-speakers-with-mobile-phone-small-mini-speaker-portable-overweight-subwoofer-high-volume-radio-3d-surround-home-colorful-lighting-outdoor-speaker-i1897545958.html
https://www.lazada.com.ph/products/cracks-mini-bluetooth-speaker-with-changing-led-lights-support-fm-usb-tf-bluetooth-i361804696.html
Md. Fazlul Hoque
  • 15,806
  • 5
  • 12
  • 32
  • Thanks a lot for the help. I'm curious to know why do the two XPATHs differ. Also, do you write your XPATHs down manually. I usually inspect the element in my chrome broswer->right click-> and click copy XPATH. I'm curious to know how you obtain your XPATHs. Thanks –  Apr 24 '22 at 14:06
  • I select two xpath legacy way meaning 2nd xpath portion depends on 1st one ,otherwise it gives a bit unnecessary output. I prove my elements selection whether it's correct or not using chrome devtools. Thanks – Md. Fazlul Hoque Apr 24 '22 at 14:23