I am looking for help with a specific problem to get data from a postback table. I need to access a table that is loaded after pressing a button with a JavaScript PostbackWithOption. I think I am using the incorrect request because the table is not loading. I notice that the Postback is nested in another postback and should be the reason I cannot get to the table. Any advice is well received
The table is under the "Transfers" window in this link https://www83.hattrick.org/en-us/Club/Players/Player.aspx?playerId=469061287
This is the code I am using now:
def transf_tab(self,response):
open_in_browser(response)
#This is the code in the webpage javascript: WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ctl00$CPContent$CPMain$btnViewTransferHistory", "", true, "", "", false, true))
transfToken = response.xpath('//*[@id="__VIEWSTATE"]/@value').extract_first()
target ="ctl00$ctl00$CPContent$CPMain$btnViewTransferHistory"
# viewstategen = "0C55417A"
data = {'__EVENTTARGET': target,'__VIEWSTATE': transfToken},
return FormRequest(url=response.url,
method= 'POST',
formdata=data,
dont_filter= True,
callback=self.parse_player)
def parse_player(self, response):
open_in_browser(response)
trsf_item = HtsellsItem()
I have been able to scrap different webs using postback, but this time, after running the FormRequest, the table is not loaded, and there is some "new information" and some other information missing too