Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Código para Classname e Id en la misma linea de pagina web

publicado

Hola a tod@s.

Me adelanto dando las gracias por su tiempo en ayudarme en mi caso.

Tengo una macro que extrae información de la página web de venta de autos el problema está en extraer ciertos secciones por ejemplo: details, features y specifications.

<div class="tab-content" id="sections-contents">
   <div class="tab-pane fade" id="details" role="tabpanel" aria-labelledby="details-tab" data-webm-section="features-tab-details">
   <div class="tab-pane fade" id="features" role="tabpanel" aria-labelledby="features-tab" data-webm-section="features-tab-features">
   <div class="tab-pane fade" id="specifications" role="tabpanel" aria-labelledby="specifications-tab" data-webm-section="features-tab-specifications">

La sección ¨details¨ a su vez se desglosa en varios items y estos a su vez en otros

Por ejemplo Items de "details":

<div class="row features-item features-item-vehculo">
<div class="row features-item features-item-precio">
<div class="row features-item features-item-kilmetros">

Por ahora necesito extraer toda la sección

 <div class="tab-pane fade" id="details" role="tabpanel" aria-labelledby="details-tab" data-webm-section="features-tab-details">

He intentado lo siguiente:

'----Detalles
        Set htmlims = htmldoc.getElementsByClassName("tab-pane fade")
        For Each htmlim In htmlims
            Sheets("Hoja1").Cells(fila, 7).Value = htmlim.innerText
        Next htmlim

El cual funciona bien solo que después pasa a extraer la sección de:

<div class="tab-pane fade" id="features" role="tabpanel" aria-labelledby="features-tab" data-webm-section="features-tab-features">

Temporalmente lo he solucionado agregando la siguiente línea antes del Next:

          If fila = fila Then Exit For

      Next htmlim

Sin embargo, en la página web ciertos autos no tienen las tres secciones antes mencionadas en ocasiones solo tienen uno o dos secciones. 

Intentando escribir htmlim.getElementsByTagName("details")innerText u otros intentos me aparecen mensajes de errores.

Espero haberme hecho entender.

Saludos

 

 

Featured Replies

No hay posts para mostrar

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.