Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

219
Vistas
I want to send JS POST requests using Selenium, but new XMLHttprequests in JS is not defind

I have been googling and reading MDN, and trying different things, and still can not get it to work.Is anyone able to help with this?Why does it cause such a problem?

js = '''
var xhr = new XMLHttpRequest();
xhr.open('POST', 'https://www.ti.com.cn/occservices/v2/ti/addtocart', false);
xhr.setRequestHeader('Content-type', 'application/json');
xhr.send('{"cartRequestList":[{"packageOption":null,"opnId":"%s","quantity":"%d","tiAddtoCartSource":"store-pdp","dienCode":"","year":"","week":"","batchCode":"","pcrCode":"","sparam":""}],"currency":"CNY"}');
return xhr.response;''' % (product['opn'], product['num'])
js = js.replace(" ", "").replace("\n", "")
resp = driver.execute_script(js)
return resp
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda