ขยายคำถามต่อจากอันนี้ :
https://pantip.com/topic/42416374
function getdetail(){
//document.body.style.zoom = 0.1
const table = document.getElementsByClassName("ag-root ag-unselectable ag-layout-auto-height")[0];
const header = table.querySelectorAll("div.ag-header-viewport")[0].innerText.split("\n");
const customerdetail = table.querySelectorAll("div.ag-row");
const databalance = [];
customerdetail.forEach(row => databalance.push([row.innerText.split("\n")]));
databalance.forEach(row =>{
const custacc = row[1]; // account number
const custname = row[0]; // name
const custcode = row[9] // code
const custavaliable_units = row[10]; // avaliable balance units
const custavaliable_price = row[11]; // avaliable balance thb
})
//document.body.style.zoom = 1.0;
}
จากการทดสอบรันออกมา พบว่า บาง ที array ที่ได้ ก็มี row.innerText.split("\n") ที่มีสมาชิก 8 ตัว บางที ก็มี 39 ตัว (ข้อมูลมี 39 ตัว)
เกิดจากการ zoom out หน้าจอ ถ้าเราต้องการข้อมูล ที่ได้ จากการ zoom out เล็กสุด เพื่อได้ให้ข้อมูลครบ ต้องศึกษา code ส่วนไหนหรือครับ ปกติเค้าใช้อะไร ในการทำ ถ้าต้องการ ให้คงที่ ไม่ผันแปรไปตามหน้าจอแต่ละคน หนะครับ กลไกแบบนี้ มันเกิดจากอะไร และเราจะมีวิธี ดำเนินการอย่างไร กับ กลไกแบบนี้หนะครับ ขอบคุณครับ
Javascript : extract data from web app
//document.body.style.zoom = 0.1
const table = document.getElementsByClassName("ag-root ag-unselectable ag-layout-auto-height")[0];
const header = table.querySelectorAll("div.ag-header-viewport")[0].innerText.split("\n");
const customerdetail = table.querySelectorAll("div.ag-row");
const databalance = [];
customerdetail.forEach(row => databalance.push([row.innerText.split("\n")]));
databalance.forEach(row =>{
const custacc = row[1]; // account number
const custname = row[0]; // name
const custcode = row[9] // code
const custavaliable_units = row[10]; // avaliable balance units
const custavaliable_price = row[11]; // avaliable balance thb
})
//document.body.style.zoom = 1.0;
}
เกิดจากการ zoom out หน้าจอ ถ้าเราต้องการข้อมูล ที่ได้ จากการ zoom out เล็กสุด เพื่อได้ให้ข้อมูลครบ ต้องศึกษา code ส่วนไหนหรือครับ ปกติเค้าใช้อะไร ในการทำ ถ้าต้องการ ให้คงที่ ไม่ผันแปรไปตามหน้าจอแต่ละคน หนะครับ กลไกแบบนี้ มันเกิดจากอะไร และเราจะมีวิธี ดำเนินการอย่างไร กับ กลไกแบบนี้หนะครับ ขอบคุณครับ