excel input control
This commit is contained in:
@@ -315,9 +315,6 @@ func (l *Luca) BordroTableMaping(frame *rod.Page, b *LucaBordro) ([]BordroPageSc
|
|||||||
//table := frame.MustElements(".i2")
|
//table := frame.MustElements(".i2")
|
||||||
var mainText string
|
var mainText string
|
||||||
for t := 0; t < len(table); t++ {
|
for t := 0; t < len(table); t++ {
|
||||||
if t == 150 {
|
|
||||||
fmt.Print("asda")
|
|
||||||
}
|
|
||||||
inputElement, err := table[t].Element("input")
|
inputElement, err := table[t].Element("input")
|
||||||
text, err := table[t].Text()
|
text, err := table[t].Text()
|
||||||
fmt.Print(mainText)
|
fmt.Print(mainText)
|
||||||
@@ -327,13 +324,13 @@ func (l *Luca) BordroTableMaping(frame *rod.Page, b *LucaBordro) ([]BordroPageSc
|
|||||||
if inputElement != nil {
|
if inputElement != nil {
|
||||||
if mainText != "" {
|
if mainText != "" {
|
||||||
fmt.Print(t)
|
fmt.Print(t)
|
||||||
inputElement, err := table[t+1].Element("input")
|
elem, err := table[t+1].Element("input")
|
||||||
if inputElement == nil {
|
if elem == nil {
|
||||||
mainText = ""
|
mainText = ""
|
||||||
fmt.Print("Hatalı Text")
|
fmt.Print("Hatalı Text")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
id, err := inputElement.Attribute("id")
|
id, err := elem.Attribute("id")
|
||||||
|
|
||||||
fmt.Print(err)
|
fmt.Print(err)
|
||||||
pageScript := BordroPageScript{
|
pageScript := BordroPageScript{
|
||||||
@@ -347,37 +344,33 @@ func (l *Luca) BordroTableMaping(frame *rod.Page, b *LucaBordro) ([]BordroPageSc
|
|||||||
mainText = ""
|
mainText = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if t <= len(table)-2 {
|
||||||
|
if text != "" {
|
||||||
|
aad, err := table[t+1].Element("input")
|
||||||
|
fmt.Print(err)
|
||||||
|
if aad != nil {
|
||||||
|
aa, err := aad.Attribute("type")
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if *aa != "hidden" {
|
||||||
|
id, err := aad.Attribute("id")
|
||||||
|
pageScript := BordroPageScript{
|
||||||
|
Value: text,
|
||||||
|
Index: *id,
|
||||||
|
}
|
||||||
|
scriptIndexArray = append(scriptIndexArray, pageScript)
|
||||||
|
fmt.Print(aad, err, id, aa)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// Satırın özelliklerini al
|
|
||||||
|
|
||||||
// Satırın textini al
|
|
||||||
|
|
||||||
fmt.Print(err)
|
fmt.Print(err)
|
||||||
|
|
||||||
// for k, v := range b.Ucretler {
|
|
||||||
// fmt.Print(v, k)
|
|
||||||
// //table'da key--> k i bul,
|
|
||||||
// //takip eden ilk td'deki ilk input'a v'yi yaz
|
|
||||||
// //table'da k'yi bulmazsan ve v de değer varsa hata dön
|
|
||||||
// if strings.Contains(text, k) {
|
|
||||||
// Id := ""
|
|
||||||
// if id != nil {
|
|
||||||
// Id = *id
|
|
||||||
// fmt.Println("ID:", *id)
|
|
||||||
// } else {
|
|
||||||
// Id = ""
|
|
||||||
// }
|
|
||||||
// pageScript := BordroPageScript{
|
|
||||||
// Value: text,
|
|
||||||
// Index: Id,
|
|
||||||
// }
|
|
||||||
|
|
||||||
// scriptIndexArray = append(scriptIndexArray, pageScript)
|
|
||||||
// break
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// Sonuçları yazdır ///text boşsa id de boş oluyo
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return scriptIndexArray, nil
|
return scriptIndexArray, nil
|
||||||
}
|
}
|
||||||
@@ -593,12 +586,17 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error {
|
|||||||
}
|
}
|
||||||
rsp, err := l.BordroTableMaping(frame3, b)
|
rsp, err := l.BordroTableMaping(frame3, b)
|
||||||
if len(rsp) == 0 {
|
if len(rsp) == 0 {
|
||||||
//hata ver
|
return errors.New("Bordro Tablosu Çekilemedi")
|
||||||
}
|
}
|
||||||
fmt.Print(rsp)
|
fmt.Print(rsp)
|
||||||
//rsp den dönden değerler ile matchlencek ve yazılcak
|
//rsp den dönden değerler ile matchlencek ve yazılcak
|
||||||
for k, v := range b.Ucretler {
|
for k, v := range b.Ucretler {
|
||||||
|
var elementInsertControl bool = true
|
||||||
|
tt := v.String()
|
||||||
|
fmt.Print(tt)
|
||||||
|
Wait(frame3, 100)
|
||||||
for i := 0; i < len(rsp); i++ {
|
for i := 0; i < len(rsp); i++ {
|
||||||
|
|
||||||
if k == rsp[i].Value {
|
if k == rsp[i].Value {
|
||||||
|
|
||||||
el, err := frame3.Element("#" + rsp[i].Index)
|
el, err := frame3.Element("#" + rsp[i].Index)
|
||||||
@@ -606,10 +604,30 @@ func (l *Luca) BordroYaz(month, year int, b *LucaBordro, lastItem bool) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = el.Input(v.String())
|
err = el.Input(v.String())
|
||||||
|
elementInsertControl = false
|
||||||
//el.Eval(`this.dispatchEvent(new KeyboardEvent('keydown', {'key': 'Enter'}))`)
|
//el.Eval(`this.dispatchEvent(new KeyboardEvent('keydown', {'key': 'Enter'}))`)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if elementInsertControl {
|
||||||
|
if tt != "0" {
|
||||||
|
newBordroPage, err := frame3.Element("body > form > table > tbody > tr.altBar.alt-button-bar > th > table > tbody > tr > td:nth-child(1) > button:nth-child(4)")
|
||||||
|
newBordroPage.WaitLoad()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
newBordroPage.Click(proto.InputMouseButtonLeft, 1)
|
||||||
|
err = WaitLoad(frame3)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
err = ClickItem(frame3, "body > form > table > tbody > tr.altBar.alt-button-bar > th > table > tbody > tr > td:nth-child(1) > button:nth-child(3)", 1)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return errors.New(k + " Sütunu Bulunamadı Taslak Hatası, ")
|
||||||
|
}
|
||||||
|
}
|
||||||
fmt.Print(v, k)
|
fmt.Print(v, k)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user