需要代码行才能从下拉列表中选择付款方式 [英] Requiring line of code to select nature of payment from drop down list

查看:76
本文介绍了需要代码行才能从下拉列表中选择付款方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵守了下面提到的代码行,但是没有用.我无法弄清楚如何选择付款方式,付款选项卡的性质标记在所附图像的箭头之间.

I complied the below mentiond code line, but it is not working. I'm not able to figure out how to select nature of payment , the nature of payment tab is marked between arrows in the attached image.

Sub TDS_Autofill()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "https://onlineservices.tin.egov-nsdl.com/etaxnew/tdsnontds.jsp"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop

Set doc = IE.document

doc.parentWindow.execScript "sendRequest(281)", "JavaScript"

Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop


If ThisWorkbook.Sheets("Challan AutoFill").Range("m2").Value = "Company" 
Then
doc.getElementById("0020").Click
ElseIf ThisWorkbook.Sheets("Challan AutoFill").Range("m2").Value = "Non 
Company" Then
doc.getElementById("0021").Click
End If



If ThisWorkbook.Sheets("Challan AutoFill").Range("o2").Value = "(200) 
TDS/TCS Payable by Taxpayer" Then
doc.getElementById("200").Click
ElseIf ThisWorkbook.Sheets("Challan AutoFill").Range("o2").Value = "(400) 
TDS/TCS Regular Assessment" Then
doc.getElementById("400").Click
End If

doc.getElementsByName("NaturePayment").Value = ThisWorkbook.Sheets("Challan 
AutoFill").Range("q2").Value



End Sub

推荐答案

您可以在select本身上使用selectedIndex,然后在该选择下的列表中指定感兴趣的选项的索引.我

You can use selectedIndex on the select itself then specify index of option of interest in the list under that select. I

ie.document.querySelector("select.form-control").SelectedIndex = 2 '3 or 3 etc....

在选项元素本身上使用.Selected = True,例如

Use .Selected = True on the option element itself e.g.

ie.document.querySelector("[value='193 - Interest on Securities']").Selected = True

这篇关于需要代码行才能从下拉列表中选择付款方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆