Leo el documento Selenium y trato de codificar como documento. Ejecuto el código, abre los navegadores Chrome ok. Pero tiene problema, no se donde aparece la sentencia console.log?. Porque busco en la pestaña Consola f12 en Chrome o Visual Studio Code no aparece console.log. ¡Ayúdame!
Gracias a todos
Navegador Google Chrome: Versión 97.0.4692.71 y ChromeDriver 98.0.4758.48
Instalé alguna biblioteca en el proyecto.
chromedriver: "^97.0.0" selenio-webdriver: "^4.1.1"
Este es mi código:
const { Builder, By } = require("selenium-webdriver"); const chrome = require("selenium-webdriver/chrome"); require("chromedriver"); async function DisplayListElement() { let options = new chrome.Options(); let driver = await new Builder() .forBrowser("chrome") .setChromeOptions(options) .build(); try { // Navigate to Url await driver.get("https://www.example.com"); // Get all the elements available with tag 'p' let elements = await driver.findElements(By.css("p")); for (let e of elements) { console.log(await e.getText()); } } finally { await driver.quit(); } } DisplayListElement();Fue un problema cuando se estaba ejecutando de la siguiente manera:
[7476:8716:0117/152805.277:ERROR:chrome_browser_main_extra_parts_metrics.cc(227)] START: ReportBluetoothAvailability(). If you don't see the END: message, this is crbug.com/1216328. [7476:8716:0117/152805.310:ERROR:chrome_browser_main_extra_parts_metrics.cc(230)] END: ReportBluetoothAvailability() [7476:8716:0117/152805.316:ERROR:chrome_browser_main_extra_parts_metrics.cc(235)] START: GetDefaultBrowser(). If you don't see the END: message, this is crbug.com/1216328. [7476:9600:0117/152805.335:ERROR:device_event_log_impl.cc(214)] [15:28:05.335] USB: usb_device_handle_win.cc:1050 Failed to read descriptor from node connection: A device attached toce attached to not functioning. (0x1F) [7476:9600:0117/152805.335:ERROR:device_event_log_impl.cc(214)] [15:28:05.335] USB: usb_device_handle_win.cc:1050 Failed to read descr ce attached toiptor from node connection: A devievice_event_log_impl.cc(214)] [15:28:05.566] USB: usb_device_handle_win.cc:1050 Failed to read descriptor from node connection: A devi[7476:9600:0117/152805.335:ERROR:device_event_log_impl.cc(214)] [15:28:05.335] USB: usb_device_handle_win.cc:1050 Failed to read descr117/152805.566:ERROR:device_event_log_impl.cc(214)] [15:28:05.566] USB: usb_device_handle_win.cc:1050 Failed to read descr. (0x1F) [7476:9600:0117/152805.566:ERROR:device_event_log_impl.cc(214)] [15:28:05.566] USB: usb_device_handle_win.cc:1050 Failed to read descriptor from node connection: A device attached toonnection: A device attached to the system is not functioning. (0x1F) [7476:8716:0117/152805.687:ERROR:chrome_browser_main_extra_parts_metrics.cc(239)] END: GetDefaultBrowser()